Skip to content

Commit

Permalink
test: fix jest importment in neuron-ui module
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Nov 21, 2023
1 parent bfbc756 commit 3bb96a9
Show file tree
Hide file tree
Showing 47 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/neuron-ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/*.stories.*', 'src/setupTests.ts'],
devDependencies: ['**/*.stories.*', 'src/setupTests.ts', '**/*.test.ts'],
},
],
'import/extensions': [
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@babel/preset-typescript": "7.23.3",
"@jest/globals": "27.5.1",
"@storybook/addon-actions": "7.0.24",
"@storybook/addon-essentials": "7.0.24",
"@storybook/addon-interactions": "7.0.24",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import calculateAPC from 'utils/calculateAPC'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import calculateClaimEpochValue from 'utils/calculateClaimEpochValue'
import fixtures from './fixtures.json'

Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/calendar/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import {
isDayInRange,
isMonthInRange,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { CKBToShannonFormatter } from 'utils/formatters'
import { CapacityUnit } from 'utils'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { addressesToBalance } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { bytesFormatter } from 'utils/formatters'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { complexNumberToPureNumber } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { currencyFormatter } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { difficultyFormatter } from 'utils/formatters'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { outputsToTotalAmount } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import { padFractionDigitsIfDecimal } from 'utils/formatters'

describe('padFractionDigitsIfDecimal', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { sUDTAmountFormatter } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { shannonToCKBFormatter } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import { sporeFormatter, truncateMiddle } from 'utils/formatters'

describe('sporeFormatter', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { sudtAmountToValue } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { sudtValueToAmount } from 'utils/formatters'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import getCompensatedTime from 'utils/getCompensatedTime'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import getCompensationPeriod from 'utils/getCompensationPeriod'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { ConnectionStatus } from 'utils'
import getConnectionStatus from 'utils/getConnectionStatus'
import fixtures from './fixtures.json'
Expand All @@ -9,6 +10,6 @@ describe('Test getConnectionStatus', () => {

test.each(fixtureTable)(`%s`, (_title, params, expected) => {
expect.assertions(1)
expect(getConnectionStatus(...params)).toBe(expected)
expect(getConnectionStatus(params[0])).toBe(expected)
})
})
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import getDAOCellStatus, { CellStatus } from 'utils/getDAOCellStatus'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import { MultisigConfig } from 'services/remote'
import getMultisigSignStatus from 'utils/getMultisigSignStatus'
import { addressToScript, scriptToHash } from '@nervosnetwork/ckb-sdk-utils'
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/getPageNoList/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import getPageNoList from 'utils/getPageNoList'
import fixtures from './fixtures'

Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/getSyncLeftTime/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import getSyncLeftTime from 'utils/getSyncLeftTime'
import fixtures from './fixtures.json'

Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/is/isMainnet/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isMainnet } from 'utils/is'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isReadyByVersion } from 'utils/is'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isSuccessResponse } from 'utils/is'
import fixtures from './fixtures'

Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/parsers/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import { listParams, epochParser, toUint128Le } from 'utils/parsers'

describe('listParams', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/sortAccounts/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import sortAccounts, { Account } from 'utils/sortAccounts'
import fixtures from './fixtures.json'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateAddress } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateAmount } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateAmountRange } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateAssetAccountAddress } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateAssetAccountName } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateDecimal } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateNetworkName } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { validateOutputs } from 'utils/validators'
import fixtures from './fixtures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validatePasswordComplexity } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateAssetAccountAmount } from 'utils/validators'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateSymbol } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateTokenId } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateTokenName } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateTotalAmount } from 'utils/validators'

Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/tests/validators/url/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { isErrorWithI18n } from 'exceptions'
import { validateURL } from 'utils/validators'
import fixtures from './fixtures'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '../../src/types/ckbComponents.d.ts'
import { Subject } from 'rxjs'
import { Tip } from '@ckb-lumos/base'
import { scriptToAddress } from '../../src/utils/scriptAndAddress'
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@
jest-mock "^27.5.1"
jest-util "^27.5.1"

"@jest/globals@^27.5.1":
"@jest/globals@27.5.1", "@jest/globals@^27.5.1":
version "27.5.1"
resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.5.1.tgz#7ac06ce57ab966566c7963431cef458434601b2b"
integrity sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==
Expand Down

0 comments on commit 3bb96a9

Please sign in to comment.