From 6aa9f5bf789e3a846492459060084b7ad6d3b600 Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Fri, 21 May 2021 15:46:50 +0800 Subject: [PATCH] Change toEqual and toBe to toStrictEqual (#102) * Change toEqual to toStrictEqual * Change toBe to toStrictEqual --- .../__tests__/api/address.test.ts | 84 ++++---- .../__tests__/api/poolpair.test.ts | 41 ++-- .../__tests__/api/rpc.test.ts | 12 +- .../__tests__/api/tokens.test.ts | 18 +- .../__tests__/api/transaction.test.ts | 26 +-- .../__tests__/errors/api.error.test.ts | 10 +- .../errors/api.validation.exception.test.ts | 8 +- .../errors/client.timeout.exception.test.ts | 2 +- .../__tests__/stub.service.ts | 2 +- .../__tests__/whale.api.response.test.ts | 14 +- .../__tests__/whale.rpc.client.test.ts | 12 +- src/e2e.module.ts | 2 +- .../_core/api.paged.response.spec.ts | 4 +- src/module.api/address.controller.e2e.ts | 80 ++++---- src/module.api/address.controller.spec.ts | 26 +-- .../cache/poolpair.info.cache.spec.ts | 12 +- src/module.api/cache/token.info.cache.spec.ts | 16 +- src/module.api/guards/network.guard.e2e.ts | 4 +- src/module.api/health.e2e.ts | 8 +- src/module.api/poolpair.controller.spec.ts | 32 ++-- src/module.api/rpc.controller.spec.ts | 2 +- src/module.api/tokens.controller.spec.ts | 14 +- .../transactions.controller.spec.ts | 8 +- .../database.spec/specifications.ts | 180 +++++++++--------- src/module.database/index.spec.ts | 8 +- src/module.indexer/indexer.spec/block.spec.ts | 10 +- .../indexer.spec/script.spec.ts | 62 +++--- .../indexer.spec/transaction.spec.ts | 8 +- src/module.model/_hex.encoder.spec.ts | 24 +-- src/module.model/block.spec.ts | 22 +-- src/module.model/raw.block.spec.ts | 2 +- src/module.model/script.activity.spec.ts | 20 +- 32 files changed, 386 insertions(+), 387 deletions(-) diff --git a/packages/whale-api-client/__tests__/api/address.test.ts b/packages/whale-api-client/__tests__/api/address.test.ts index 0f3070dd2..9e039669f 100644 --- a/packages/whale-api-client/__tests__/api/address.test.ts +++ b/packages/whale-api-client/__tests__/api/address.test.ts @@ -54,7 +54,7 @@ describe('getBalance', () => { it('should getBalance zero for bech32', async () => { const address = await container.getNewAddress() const balance = await client.address.getBalance(address) - expect(balance).toBe('0.00000000') + expect(balance).toStrictEqual('0.00000000') }) it('should getBalance for bech32', async () => { @@ -64,7 +64,7 @@ describe('getBalance', () => { await service.waitForAddressTxCount(address, 1) const balance = await client.address.getBalance(address) - expect(balance).toBe('1.23000000') + expect(balance).toStrictEqual('1.23000000') }) it('should getBalance for legacy', async () => { @@ -74,7 +74,7 @@ describe('getBalance', () => { await service.waitForAddressTxCount(address, 1) const balance = await client.address.getBalance(address) - expect(balance).toBe('1.92822343') + expect(balance).toStrictEqual('1.92822343') }) it('should getBalance for p2sh', async () => { @@ -84,7 +84,7 @@ describe('getBalance', () => { await service.waitForAddressTxCount(address, 1) const balance = await client.address.getBalance(address) - expect(balance).toBe('1.23419341') + expect(balance).toStrictEqual('1.23419341') }) }) @@ -98,7 +98,7 @@ it('should getAggregation', async () => { await service.waitForAddressTxCount(address, 3) const agg = await client.address.getAggregation(address) - expect(agg).toEqual({ + expect(agg).toStrictEqual({ amount: { txIn: '24.38471696', txOut: '0.00000000', @@ -125,36 +125,36 @@ it('should getAggregation', async () => { describe('tokens', () => { it('should listToken', async () => { const response = await client.address.listToken(address) - expect(response.length).toBe(5) - expect(response.hasNext).toBe(false) + expect(response.length).toStrictEqual(5) + expect(response.hasNext).toStrictEqual(false) - expect(response[0]).toEqual(expect.objectContaining({ id: '0', amount: '15.50000000', symbol: 'DFI' })) - expect(response[4]).toEqual(expect.objectContaining({ id: '4', amount: '10.00000000', symbol: 'D' })) + expect(response[0]).toStrictEqual(expect.objectContaining({ id: '0', amount: '15.50000000', symbol: 'DFI' })) + expect(response[4]).toStrictEqual(expect.objectContaining({ id: '4', amount: '10.00000000', symbol: 'D' })) }) it('should paginate listToken', async () => { const first = await client.address.listToken(address, 2) - expect(first.length).toBe(2) - expect(first.hasNext).toBe(true) - expect(first.nextToken).toBe('1') + expect(first.length).toStrictEqual(2) + expect(first.hasNext).toStrictEqual(true) + expect(first.nextToken).toStrictEqual('1') - expect(first[0]).toEqual(expect.objectContaining({ id: '0', amount: '15.50000000', symbol: 'DFI' })) - expect(first[1]).toEqual(expect.objectContaining({ id: '1', amount: '10.00000000', symbol: 'A' })) + expect(first[0]).toStrictEqual(expect.objectContaining({ id: '0', amount: '15.50000000', symbol: 'DFI' })) + expect(first[1]).toStrictEqual(expect.objectContaining({ id: '1', amount: '10.00000000', symbol: 'A' })) const next = await client.paginate(first) - expect(next.length).toBe(2) - expect(next.hasNext).toBe(true) - expect(next.nextToken).toBe('3') + expect(next.length).toStrictEqual(2) + expect(next.hasNext).toStrictEqual(true) + expect(next.nextToken).toStrictEqual('3') - expect(next[0]).toEqual(expect.objectContaining({ id: '2', amount: '10.00000000', symbol: 'B' })) - expect(next[1]).toEqual(expect.objectContaining({ id: '3', amount: '10.00000000', symbol: 'C' })) + expect(next[0]).toStrictEqual(expect.objectContaining({ id: '2', amount: '10.00000000', symbol: 'B' })) + expect(next[1]).toStrictEqual(expect.objectContaining({ id: '3', amount: '10.00000000', symbol: 'C' })) const last = await client.paginate(next) - expect(last.length).toBe(1) - expect(last.hasNext).toBe(false) + expect(last.length).toStrictEqual(1) + expect(last.hasNext).toStrictEqual(false) expect(last.nextToken).toBeUndefined() - expect(last[0]).toEqual(expect.objectContaining({ id: '4', amount: '10.00000000', symbol: 'D' })) + expect(last[0]).toStrictEqual(expect.objectContaining({ id: '4', amount: '10.00000000', symbol: 'D' })) }) }) @@ -188,10 +188,10 @@ describe('transactions', () => { it('should listTransaction', async () => { const transactions = await client.address.listTransaction(addressA.bech32) - expect(transactions.length).toBe(3) - expect(transactions.hasNext).toBe(false) + expect(transactions.length).toStrictEqual(3) + expect(transactions.hasNext).toStrictEqual(false) - expect(transactions[2]).toEqual({ + expect(transactions[2]).toStrictEqual({ block: { hash: expect.stringMatching(/[0-f]{64}/), height: expect.any(Number) @@ -216,27 +216,27 @@ describe('transactions', () => { it('should paginate listTransaction', async () => { const first = await client.address.listTransaction(addressA.bech32, 2) - expect(first.length).toBe(2) - expect(first.hasNext).toBe(true) + expect(first.length).toStrictEqual(2) + expect(first.hasNext).toStrictEqual(true) expect(first.nextToken).toMatch(/[0-f]{80}/) - expect(first[0]).toEqual(expect.objectContaining({ value: '9.50000000', type: 'vin' })) - expect(first[1]).toEqual(expect.objectContaining({ value: '9.50000000', type: 'vout' })) + expect(first[0]).toStrictEqual(expect.objectContaining({ value: '9.50000000', type: 'vin' })) + expect(first[1]).toStrictEqual(expect.objectContaining({ value: '9.50000000', type: 'vout' })) const next = await client.paginate(first) - expect(next.length).toBe(1) - expect(next.hasNext).toBe(false) + expect(next.length).toStrictEqual(1) + expect(next.hasNext).toStrictEqual(false) - expect(next[0]).toEqual(expect.objectContaining({ value: '34.00000000', type: 'vout' })) + expect(next[0]).toStrictEqual(expect.objectContaining({ value: '34.00000000', type: 'vout' })) }) it('should listTransactionUnspent', async () => { const unspent = await client.address.listTransactionUnspent(addressA.bech32) - expect(unspent.length).toBe(1) - expect(unspent.hasNext).toBe(false) + expect(unspent.length).toStrictEqual(1) + expect(unspent.hasNext).toStrictEqual(false) - expect(unspent[0]).toEqual({ + expect(unspent[0]).toStrictEqual({ block: { hash: expect.stringMatching(/[0-f]{64}/), height: expect.any(Number) @@ -259,19 +259,19 @@ describe('transactions', () => { it('should paginate listTransactionUnspent', async () => { const first = await client.address.listTransactionUnspent(addressB.bech32, 1) - expect(first.length).toBe(1) - expect(first.hasNext).toBe(true) + expect(first.length).toStrictEqual(1) + expect(first.hasNext).toStrictEqual(true) expect(first.nextToken).toMatch(/[0-f]{80}/) - expect(first[0].vout.value).toBe('2.93719381') + expect(first[0].vout.value).toStrictEqual('2.93719381') const next = await client.paginate(first) - expect(next.length).toBe(1) - expect(next.hasNext).toBe(true) + expect(next.length).toStrictEqual(1) + expect(next.hasNext).toStrictEqual(true) - expect(next[0].vout.value).toBe('9.49990000') + expect(next[0].vout.value).toStrictEqual('9.49990000') const empty = await client.paginate(next) - expect(empty.length).toBe(0) + expect(empty.length).toStrictEqual(0) }) }) diff --git a/packages/whale-api-client/__tests__/api/poolpair.test.ts b/packages/whale-api-client/__tests__/api/poolpair.test.ts index 4dbaff565..6cb90b0f4 100644 --- a/packages/whale-api-client/__tests__/api/poolpair.test.ts +++ b/packages/whale-api-client/__tests__/api/poolpair.test.ts @@ -71,10 +71,10 @@ describe('list', () => { it('should list', async () => { const response = await client.poolpair.list(30) - expect(response.length).toBe(8) - expect(response.hasNext).toBe(false) + expect(response.length).toStrictEqual(8) + expect(response.hasNext).toStrictEqual(false) - expect(response[1]).toEqual({ + expect(response[1]).toStrictEqual({ id: '8', symbol: 'A-C', name: 'A-C', @@ -94,7 +94,6 @@ describe('list', () => { tradeEnabled: true, ownerAddress: expect.any(String), rewardPct: 0, - customRewards: undefined, creation: { tx: expect.any(String), height: expect.any(Number) @@ -104,30 +103,30 @@ describe('list', () => { it('should list with pagination', async () => { const first = await client.poolpair.list(3) - expect(first.length).toBe(3) - expect(first.hasNext).toBe(true) - expect(first.nextToken).toBe('9') + expect(first.length).toStrictEqual(3) + expect(first.hasNext).toStrictEqual(true) + expect(first.nextToken).toStrictEqual('9') - expect(first[0].symbol).toBe('A-B') - expect(first[1].symbol).toBe('A-C') - expect(first[2].symbol).toBe('A-D') + expect(first[0].symbol).toStrictEqual('A-B') + expect(first[1].symbol).toStrictEqual('A-C') + expect(first[2].symbol).toStrictEqual('A-D') const next = await client.paginate(first) - expect(next.length).toBe(3) - expect(next.hasNext).toBe(true) - expect(next.nextToken).toBe('12') + expect(next.length).toStrictEqual(3) + expect(next.hasNext).toStrictEqual(true) + expect(next.nextToken).toStrictEqual('12') - expect(next[0].symbol).toBe('A-E') - expect(next[1].symbol).toBe('A-F') - expect(next[2].symbol).toBe('B-C') + expect(next[0].symbol).toStrictEqual('A-E') + expect(next[1].symbol).toStrictEqual('A-F') + expect(next[2].symbol).toStrictEqual('B-C') const last = await client.paginate(next) - expect(last.length).toBe(2) - expect(last.hasNext).toBe(false) + expect(last.length).toStrictEqual(2) + expect(last.hasNext).toStrictEqual(false) expect(last.nextToken).toBeUndefined() - expect(last[0].symbol).toBe('B-D') - expect(last[1].symbol).toBe('B-E') + expect(last[0].symbol).toStrictEqual('B-D') + expect(last[1].symbol).toStrictEqual('B-E') }) }) @@ -135,7 +134,7 @@ describe('get', () => { it('should get', async () => { const response = await client.poolpair.get('7') - expect(response).toEqual({ + expect(response).toStrictEqual({ id: '7', symbol: 'A-B', name: 'A-B', diff --git a/packages/whale-api-client/__tests__/api/rpc.test.ts b/packages/whale-api-client/__tests__/api/rpc.test.ts index 1fd44e4e4..0998bc88a 100644 --- a/packages/whale-api-client/__tests__/api/rpc.test.ts +++ b/packages/whale-api-client/__tests__/api/rpc.test.ts @@ -42,21 +42,21 @@ describe('whitelisted rpc methods', () => { it('should rpc.call(getblockchaininfo)', async () => { const info = await client.rpc.call('getblockchaininfo', [], 'number') - expect(info.chain).toBe('regtest') - expect(typeof info.blocks).toBe('number') + expect(info.chain).toStrictEqual('regtest') + expect(typeof info.blocks).toStrictEqual('number') }) it('should rpc.call(getblockcount)', async () => { const count = await client.rpc.call('getblockcount', [], 'number') - expect(typeof count).toBe('number') + expect(typeof count).toStrictEqual('number') }) it('should rpc.call(getblockhash)', async () => { await container.generate(1) const hash = await client.rpc.call('getblockhash', [1], 'number') - expect(hash.length).toBe(64) + expect(hash.length).toStrictEqual(64) }) it('should rpc.call(getblock)', async () => { @@ -65,7 +65,7 @@ describe('whitelisted rpc methods', () => { const hash = await client.rpc.call('getblockhash', [1], 'number') const block = await client.rpc.call>('getblock', [hash], 'number') - expect(block.hash.length).toBe(64) - expect(Array.isArray(block.tx)).toBe(true) + expect(block.hash.length).toStrictEqual(64) + expect(Array.isArray(block.tx)).toStrictEqual(true) }) }) diff --git a/packages/whale-api-client/__tests__/api/tokens.test.ts b/packages/whale-api-client/__tests__/api/tokens.test.ts index 59fa6ce85..78dff5a3e 100644 --- a/packages/whale-api-client/__tests__/api/tokens.test.ts +++ b/packages/whale-api-client/__tests__/api/tokens.test.ts @@ -34,7 +34,7 @@ afterAll(async () => { describe('client.tokens.list()', () => { it('should listTokens', async () => { const result = await client.tokens.list() - expect(result.length).toBe(4) + expect(result.length).toStrictEqual(4) expect(result[0]).toStrictEqual({ id: '0', @@ -64,26 +64,26 @@ describe('client.tokens.list()', () => { it('should listTokens with pagination', async () => { const first = await client.tokens.list(2) - expect(first.length).toBe(2) - expect(first.hasNext).toBe(true) - expect(first.nextToken).toBe('1') + expect(first.length).toStrictEqual(2) + expect(first.hasNext).toStrictEqual(true) + expect(first.nextToken).toStrictEqual('1') expect(first[0]).toStrictEqual(expect.objectContaining({ id: '0', symbol: 'DFI', symbolKey: 'DFI' })) expect(first[1]).toStrictEqual(expect.objectContaining({ id: '1', symbol: 'DBTC', symbolKey: 'DBTC' })) const next = await client.paginate(first) - expect(next.length).toBe(2) - expect(next.hasNext).toBe(true) - expect(next.nextToken).toBe('3') + expect(next.length).toStrictEqual(2) + expect(next.hasNext).toStrictEqual(true) + expect(next.nextToken).toStrictEqual('3') expect(next[0]).toStrictEqual(expect.objectContaining({ id: '2', symbol: 'DETH', symbolKey: 'DETH' })) expect(next[1]).toStrictEqual(expect.objectContaining({ id: '3', symbol: 'DBTC-DET', symbolKey: 'DBTC-DET' })) const last = await client.paginate(next) - expect(last.length).toBe(0) - expect(last.hasNext).toBe(false) + expect(last.length).toStrictEqual(0) + expect(last.hasNext).toStrictEqual(false) expect(last.nextToken).toBeUndefined() }) }) diff --git a/packages/whale-api-client/__tests__/api/transaction.test.ts b/packages/whale-api-client/__tests__/api/transaction.test.ts index 1c2234e88..b00898225 100644 --- a/packages/whale-api-client/__tests__/api/transaction.test.ts +++ b/packages/whale-api-client/__tests__/api/transaction.test.ts @@ -72,11 +72,11 @@ describe('raw transaction send/test', () => { const txid = await client.transactions.send({ hex: hex }) - expect(txid.length).toEqual(64) + expect(txid.length).toStrictEqual(64) await container.generate(1) const out = await container.call('gettxout', [txid, 0]) - expect(out.value).toBe(9.9999) + expect(out.value).toStrictEqual(9.9999) }) it('should send valid txn with given maxFeeRate', async () => { @@ -84,11 +84,11 @@ describe('raw transaction send/test', () => { const txid = await client.transactions.send({ hex: hex, maxFeeRate: 0.05 }) - expect(txid.length).toEqual(64) + expect(txid.length).toStrictEqual(64) await container.generate(1) const out = await container.call('gettxout', [txid, 0]) - expect(out.value).toBe(9.995) + expect(out.value).toStrictEqual(9.995) }) it('should fail due to invalid txn', async () => { @@ -119,8 +119,8 @@ describe('raw transaction send/test', () => { expect('must fail').toBeUndefined() } catch (err) { expect(err).toBeInstanceOf(WhaleApiValidationException) - expect(err.message).toBe('422 - ValidationError (/v1/regtest/transactions)') - expect(err.properties).toEqual([{ + expect(err.message).toStrictEqual('422 - ValidationError (/v1/regtest/transactions)') + expect(err.properties).toStrictEqual([{ constraints: [ 'hex must be a hexadecimal number', 'hex should not be empty' @@ -139,8 +139,8 @@ describe('raw transaction send/test', () => { expect('must fail').toBeUndefined() } catch (err) { expect(err).toBeInstanceOf(WhaleApiValidationException) - expect(err.message).toBe('422 - ValidationError (/v1/regtest/transactions)') - expect(err.properties).toEqual([{ + expect(err.message).toStrictEqual('422 - ValidationError (/v1/regtest/transactions)') + expect(err.properties).toStrictEqual([{ constraints: [ 'hex must be a hexadecimal number' ], @@ -158,8 +158,8 @@ describe('raw transaction send/test', () => { expect('must fail').toBeUndefined() } catch (err) { expect(err).toBeInstanceOf(WhaleApiValidationException) - expect(err.message).toBe('422 - ValidationError (/v1/regtest/transactions)') - expect(err.properties).toEqual([{ + expect(err.message).toStrictEqual('422 - ValidationError (/v1/regtest/transactions)') + expect(err.properties).toStrictEqual([{ constraints: [ 'maxFeeRate must not be less than 0' ], @@ -178,8 +178,8 @@ describe('raw transaction send/test', () => { expect('must fail').toBeUndefined() } catch (err) { expect(err).toBeInstanceOf(WhaleApiValidationException) - expect(err.message).toBe('422 - ValidationError (/v1/regtest/transactions)') - expect(err.properties).toEqual([{ + expect(err.message).toStrictEqual('422 - ValidationError (/v1/regtest/transactions)') + expect(err.properties).toStrictEqual([{ constraints: [ 'maxFeeRate must not be less than 0', 'maxFeeRate must be a number conforming to the specified constraints' @@ -217,6 +217,6 @@ describe('estimate fee rate', () => { it('should be fixed fee of 0.00005000 when there are no transactions', async () => { const feeRate = await client.transactions.estimateFee(10) - expect(feeRate).toBe(0.00005000) + expect(feeRate).toStrictEqual(0.00005000) }) }) diff --git a/packages/whale-api-client/__tests__/errors/api.error.test.ts b/packages/whale-api-client/__tests__/errors/api.error.test.ts index cf9f5bdb4..67ccd405d 100644 --- a/packages/whale-api-client/__tests__/errors/api.error.test.ts +++ b/packages/whale-api-client/__tests__/errors/api.error.test.ts @@ -11,9 +11,9 @@ it('WhaleApiException should be formatted as', () => { const exception = new WhaleApiException(error) - expect(exception.message).toBe('404 - NotFound (/link/to): some message') - expect(exception.code).toBe(404) - expect(exception.type).toBe('NotFound') - expect(exception.at).toBe(123) - expect(exception.url).toBe('/link/to') + expect(exception.message).toStrictEqual('404 - NotFound (/link/to): some message') + expect(exception.code).toStrictEqual(404) + expect(exception.type).toStrictEqual('NotFound') + expect(exception.at).toStrictEqual(123) + expect(exception.url).toStrictEqual('/link/to') }) diff --git a/packages/whale-api-client/__tests__/errors/api.validation.exception.test.ts b/packages/whale-api-client/__tests__/errors/api.validation.exception.test.ts index 3eeefc9a7..177b9090b 100644 --- a/packages/whale-api-client/__tests__/errors/api.validation.exception.test.ts +++ b/packages/whale-api-client/__tests__/errors/api.validation.exception.test.ts @@ -21,10 +21,10 @@ it('WhaleApiValidationException should includes properties', () => { const exception = new WhaleApiValidationException(error) - expect(exception.message).toBe('422 - ValidationError (/link/to/validation/error)') - expect(exception.code).toBe(422) - expect(exception.type).toBe('ValidationError') - expect(exception.properties).toEqual([ + expect(exception.message).toStrictEqual('422 - ValidationError (/link/to/validation/error)') + expect(exception.code).toStrictEqual(422) + expect(exception.type).toStrictEqual('ValidationError') + expect(exception.properties).toStrictEqual([ { property: 'key', value: 'value', diff --git a/packages/whale-api-client/__tests__/errors/client.timeout.exception.test.ts b/packages/whale-api-client/__tests__/errors/client.timeout.exception.test.ts index d593209f3..ebf783289 100644 --- a/packages/whale-api-client/__tests__/errors/client.timeout.exception.test.ts +++ b/packages/whale-api-client/__tests__/errors/client.timeout.exception.test.ts @@ -3,5 +3,5 @@ import { WhaleClientTimeoutException } from '../../src' it('WhaleClientTimeoutException should be structured as', () => { const exception = new WhaleClientTimeoutException(15000) - expect(exception.message).toBe('request aborted due to timeout of 15000 ms') + expect(exception.message).toStrictEqual('request aborted due to timeout of 15000 ms') }) diff --git a/packages/whale-api-client/__tests__/stub.service.ts b/packages/whale-api-client/__tests__/stub.service.ts index 69dc52f97..025c46896 100644 --- a/packages/whale-api-client/__tests__/stub.service.ts +++ b/packages/whale-api-client/__tests__/stub.service.ts @@ -31,7 +31,7 @@ export class StubService { } await waitForExpect(async () => { const agg = await aggregationMapper.getLatest(hid) - expect(agg?.statistic.txCount).toBe(txCount) + expect(agg?.statistic.txCount).toStrictEqual(txCount) }, timeout) } } diff --git a/packages/whale-api-client/__tests__/whale.api.response.test.ts b/packages/whale-api-client/__tests__/whale.api.response.test.ts index c57187f0f..cbe13381a 100644 --- a/packages/whale-api-client/__tests__/whale.api.response.test.ts +++ b/packages/whale-api-client/__tests__/whale.api.response.test.ts @@ -7,10 +7,10 @@ it('should behavior as an array', () => { const pagination = new ApiPagedResponse(response, 'GET', '/') - expect(pagination.length).toBe(10) - expect(pagination[0]).toBe(0) - expect(pagination[4]).toBe(4) - expect(pagination[9]).toBe(9) + expect(pagination.length).toStrictEqual(10) + expect(pagination[0]).toStrictEqual(0) + expect(pagination[4]).toStrictEqual(4) + expect(pagination[9]).toStrictEqual(9) expect(pagination[10]).toBeUndefined() }) @@ -24,8 +24,8 @@ it('should have next token', () => { const pagination = new ApiPagedResponse(response, 'GET', '/items') - expect(pagination.hasNext).toBe(true) - expect(pagination.nextToken).toBe('9') + expect(pagination.hasNext).toStrictEqual(true) + expect(pagination.nextToken).toStrictEqual('9') }) it('should not have next', () => { @@ -35,6 +35,6 @@ it('should not have next', () => { const pagination = new ApiPagedResponse(response, 'GET', '/items') - expect(pagination.hasNext).toBe(false) + expect(pagination.hasNext).toStrictEqual(false) expect(pagination.nextToken).toBeUndefined() }) diff --git a/packages/whale-api-client/__tests__/whale.rpc.client.test.ts b/packages/whale-api-client/__tests__/whale.rpc.client.test.ts index 225b0b77d..4e388106c 100644 --- a/packages/whale-api-client/__tests__/whale.rpc.client.test.ts +++ b/packages/whale-api-client/__tests__/whale.rpc.client.test.ts @@ -35,21 +35,21 @@ describe('whitelisted rpc methods', () => { it('should client.blockchain.getBlockchainInfo()', async () => { const info = await client.blockchain.getBlockchainInfo() - expect(info.chain).toBe('regtest') - expect(typeof info.blocks).toBe('number') + expect(info.chain).toStrictEqual('regtest') + expect(typeof info.blocks).toStrictEqual('number') }) it('should client.blockchain.getBlockCount()', async () => { const count = await client.blockchain.getBlockCount() - expect(typeof count).toBe('number') + expect(typeof count).toStrictEqual('number') }) it('should client.blockchain.getBlockHash(1)', async () => { await container.generate(1) const hash = await client.blockchain.getBlockHash(1) - expect(hash.length).toBe(64) + expect(hash.length).toStrictEqual(64) }) it('should client.blockchain.getBlock(hash, 2)', async () => { @@ -58,7 +58,7 @@ describe('whitelisted rpc methods', () => { const hash = await client.blockchain.getBlockHash(1) const block = await client.blockchain.getBlock(hash, 2) - expect(block.hash.length).toBe(64) - expect(Array.isArray(block.tx)).toBe(true) + expect(block.hash.length).toStrictEqual(64) + expect(Array.isArray(block.tx)).toStrictEqual(true) }) }) diff --git a/src/e2e.module.ts b/src/e2e.module.ts index 80f65e12c..64fd58980 100644 --- a/src/e2e.module.ts +++ b/src/e2e.module.ts @@ -79,7 +79,7 @@ export async function waitForAddressTxCount (app: NestFastifyApplication, addres const aggregationMapper = app.get(ScriptAggregationMapper) await waitForExpect(async () => { const agg = await aggregationMapper.getLatest(hid) - expect(agg?.statistic.txCount).toBe(txCount) + expect(agg?.statistic.txCount).toStrictEqual(txCount) }, timeout) } diff --git a/src/module.api/_core/api.paged.response.spec.ts b/src/module.api/_core/api.paged.response.spec.ts index 80d5a369e..39b39ff88 100644 --- a/src/module.api/_core/api.paged.response.spec.ts +++ b/src/module.api/_core/api.paged.response.spec.ts @@ -4,7 +4,7 @@ it('should create with ApiPagedResponse.next', () => { const items = [{ id: '1', sort: 'a' }, { id: '2', sort: 'b' }] expect(ApiPagedResponse.next(items).page).toBeUndefined() - expect(ApiPagedResponse.next(items, 'b').page?.next).toEqual('b') + expect(ApiPagedResponse.next(items, 'b').page?.next).toStrictEqual('b') }) it('should not create next with ApiPagedResponse.of using provider with limit = 3', () => { @@ -27,5 +27,5 @@ it('should create next with ApiPagedResponse.of using provider with limit = 3', expect(ApiPagedResponse.of(items, 3, item => { return item.sort - }).page?.next).toBe('c') + }).page?.next).toStrictEqual('c') }) diff --git a/src/module.api/address.controller.e2e.ts b/src/module.api/address.controller.e2e.ts index d63d2b35e..65581898c 100644 --- a/src/module.api/address.controller.e2e.ts +++ b/src/module.api/address.controller.e2e.ts @@ -29,7 +29,7 @@ describe('balance', () => { it('getBalance should be zero', async () => { const address = await container.getNewAddress() const balance = await controller.getBalance('regtest', address) - expect(balance).toBe('0.00000000') + expect(balance).toStrictEqual('0.00000000') }) it('should getBalance non zero with bech32 address', async () => { @@ -39,7 +39,7 @@ describe('balance', () => { await waitForAddressTxCount(app, address, 1) const balance = await controller.getBalance('regtest', address) - expect(balance).toBe('1.23000000') + expect(balance).toStrictEqual('1.23000000') }) it('should getBalance non zero with legacy address', async () => { @@ -49,7 +49,7 @@ describe('balance', () => { await waitForAddressTxCount(app, address, 1) const balance = await controller.getBalance('regtest', address) - expect(balance).toBe('0.00100000') + expect(balance).toStrictEqual('0.00100000') }) it('should getBalance non zero with p2sh-segwit address', async () => { @@ -59,7 +59,7 @@ describe('balance', () => { await waitForAddressTxCount(app, address, 1) const balance = await controller.getBalance('regtest', address) - expect(balance).toBe('10.99999999') + expect(balance).toStrictEqual('10.99999999') }) it('should sum getBalance', async () => { @@ -71,7 +71,7 @@ describe('balance', () => { await waitForAddressTxCount(app, address, 3) const balance = await controller.getBalance('regtest', address) - expect(balance).toBe('17.38471695') + expect(balance).toStrictEqual('17.38471695') }) }) @@ -85,7 +85,7 @@ describe('aggregation', () => { await waitForAddressTxCount(app, address, 3) const agg = await controller.getAggregation('regtest', address) - expect(agg).toEqual({ + expect(agg).toStrictEqual({ amount: { txIn: '17.38471695', txOut: '0.00000000', @@ -149,10 +149,10 @@ describe('transactions', () => { size: 30 }) - expect(response.data.length).toBe(8) + expect(response.data.length).toStrictEqual(8) expect(response.page).toBeUndefined() - expect(response.data[5]).toEqual({ + expect(response.data[5]).toStrictEqual({ block: { hash: expect.stringMatching(/[0-f]{64}/), height: expect.any(Number) @@ -179,32 +179,32 @@ describe('transactions', () => { const first = await controller.listTransaction('regtest', addressA.bech32, { size: 2 }) - expect(first.data.length).toBe(2) + expect(first.data.length).toStrictEqual(2) expect(first.page?.next).toMatch(/[0-f]{82}/) - expect(first.data[0].value).toBe('1.12300000') - expect(first.data[0].type).toBe('vin') - expect(first.data[1].value).toBe('1.12300000') - expect(first.data[1].type).toBe('vout') + expect(first.data[0].value).toStrictEqual('1.12300000') + expect(first.data[0].type).toStrictEqual('vin') + expect(first.data[1].value).toStrictEqual('1.12300000') + expect(first.data[1].type).toStrictEqual('vout') const next = await controller.listTransaction('regtest', addressA.bech32, { size: 10, next: first.page?.next }) - expect(next.data.length).toBe(6) + expect(next.data.length).toStrictEqual(6) expect(next.page?.next).toBeUndefined() - expect(next.data[0].value).toBe('9.50000000') - expect(next.data[0].type).toBe('vin') - expect(next.data[1].value).toBe('9.50000000') - expect(next.data[1].type).toBe('vout') - expect(next.data[2].value).toBe('2.93719381') - expect(next.data[2].type).toBe('vout') - expect(next.data[3].value).toBe('1.32412313') - expect(next.data[3].type).toBe('vout') - expect(next.data[4].value).toBe('0.12340001') - expect(next.data[4].type).toBe('vout') - expect(next.data[5].value).toBe('34.00000000') - expect(next.data[5].type).toBe('vout') + expect(next.data[0].value).toStrictEqual('9.50000000') + expect(next.data[0].type).toStrictEqual('vin') + expect(next.data[1].value).toStrictEqual('9.50000000') + expect(next.data[1].type).toStrictEqual('vout') + expect(next.data[2].value).toStrictEqual('2.93719381') + expect(next.data[2].type).toStrictEqual('vout') + expect(next.data[3].value).toStrictEqual('1.32412313') + expect(next.data[3].type).toStrictEqual('vout') + expect(next.data[4].value).toStrictEqual('0.12340001') + expect(next.data[4].type).toStrictEqual('vout') + expect(next.data[5].value).toStrictEqual('34.00000000') + expect(next.data[5].type).toStrictEqual('vout') }) it('should listTransaction with undefined next pagination', async () => { @@ -213,7 +213,7 @@ describe('transactions', () => { next: undefined }) - expect(first.data.length).toBe(2) + expect(first.data.length).toStrictEqual(2) expect(first.page?.next).toMatch(/[0-f]{82}/) }) }) @@ -224,10 +224,10 @@ describe('transactions', () => { size: 30 }) - expect(response.data.length).toBe(4) + expect(response.data.length).toStrictEqual(4) expect(response.page).toBeUndefined() - expect(response.data[3]).toEqual({ + expect(response.data[3]).toStrictEqual({ block: { hash: expect.stringMatching(/[0-f]{64}/), height: expect.any(Number) @@ -252,20 +252,20 @@ describe('transactions', () => { const first = await controller.listTransactionUnspent('regtest', addressA.bech32, { size: 2 }) - expect(first.data.length).toBe(2) + expect(first.data.length).toStrictEqual(2) expect(first.page?.next).toMatch(/[0-f]{72}/) - expect(first.data[0].vout.value).toBe('34.00000000') - expect(first.data[1].vout.value).toBe('0.12340001') + expect(first.data[0].vout.value).toStrictEqual('34.00000000') + expect(first.data[1].vout.value).toStrictEqual('0.12340001') const next = await controller.listTransactionUnspent('regtest', addressA.bech32, { size: 10, next: first.page?.next }) - expect(next.data.length).toBe(2) + expect(next.data.length).toStrictEqual(2) expect(next.page?.next).toBeUndefined() - expect(next.data[0].vout.value).toBe('1.32412313') - expect(next.data[1].vout.value).toBe('2.93719381') + expect(next.data[0].vout.value).toStrictEqual('1.32412313') + expect(next.data[1].vout.value).toStrictEqual('2.93719381') }) it('should listTransactionUnspent with undefined next pagination', async () => { @@ -274,7 +274,7 @@ describe('transactions', () => { next: undefined }) - expect(first.data.length).toBe(2) + expect(first.data.length).toStrictEqual(2) expect(first.page?.next).toMatch(/[0-f]{72}/) }) }) @@ -285,10 +285,10 @@ describe('transactions', () => { size: 30 }) - expect(response.data.length).toBe(2) + expect(response.data.length).toStrictEqual(2) expect(response.page).toBeUndefined() - expect(response.data[1]).toEqual({ + expect(response.data[1]).toStrictEqual({ block: { hash: expect.stringMatching(/[0-f]{64}/), height: expect.any(Number) @@ -318,10 +318,10 @@ describe('transactions', () => { size: 30 }) - expect(response.data.length).toBe(2) + expect(response.data.length).toStrictEqual(2) expect(response.page).toBeUndefined() - expect(response.data[1]).toEqual({ + expect(response.data[1]).toStrictEqual({ block: { hash: expect.stringMatching(/[0-f]{64}/), height: expect.any(Number) diff --git a/src/module.api/address.controller.spec.ts b/src/module.api/address.controller.spec.ts index 9d579659d..f4443e420 100644 --- a/src/module.api/address.controller.spec.ts +++ b/src/module.api/address.controller.spec.ts @@ -66,10 +66,10 @@ describe('tokens', () => { size: 30 }) - expect(response.data.length).toBe(6) + expect(response.data.length).toStrictEqual(6) expect(response.page).toBeUndefined() - expect(response.data[5]).toEqual({ + expect(response.data[5]).toStrictEqual({ id: '6', amount: '10.00000000', symbol: 'F', @@ -84,22 +84,22 @@ describe('tokens', () => { const first = await controller.listToken(address, { size: 2 }) - expect(first.data.length).toBe(2) - expect(first.page?.next).toBe('2') - expect(first.data[0].symbol).toBe('A') - expect(first.data[1].symbol).toBe('B') + expect(first.data.length).toStrictEqual(2) + expect(first.page?.next).toStrictEqual('2') + expect(first.data[0].symbol).toStrictEqual('A') + expect(first.data[1].symbol).toStrictEqual('B') const next = await controller.listToken(address, { size: 10, next: first.page?.next }) - expect(next.data.length).toBe(4) + expect(next.data.length).toStrictEqual(4) expect(next.page?.next).toBeUndefined() - expect(next.data[0].symbol).toBe('C') - expect(next.data[1].symbol).toBe('D') - expect(next.data[2].symbol).toBe('E') - expect(next.data[3].symbol).toBe('F') + expect(next.data[0].symbol).toStrictEqual('C') + expect(next.data[1].symbol).toStrictEqual('D') + expect(next.data[2].symbol).toStrictEqual('E') + expect(next.data[3].symbol).toStrictEqual('F') }) it('should listToken with undefined next pagination', async () => { @@ -108,7 +108,7 @@ describe('tokens', () => { next: undefined }) - expect(first.data.length).toBe(2) - expect(first.page?.next).toBe('2') + expect(first.data.length).toStrictEqual(2) + expect(first.page?.next).toStrictEqual('2') }) }) diff --git a/src/module.api/cache/poolpair.info.cache.spec.ts b/src/module.api/cache/poolpair.info.cache.spec.ts index 89fa857cf..b011c7543 100644 --- a/src/module.api/cache/poolpair.info.cache.spec.ts +++ b/src/module.api/cache/poolpair.info.cache.spec.ts @@ -46,14 +46,14 @@ beforeAll(async () => { it('should get from cache via get as container RPC is killed', async () => { const abPoolPair = await cache.get('A-B') - expect(abPoolPair?.symbol).toBe('A-B') - expect(abPoolPair?.name).toBe('A-B') + expect(abPoolPair?.symbol).toStrictEqual('A-B') + expect(abPoolPair?.name).toStrictEqual('A-B') const acPoolPair = await cache.get('A-C') - expect(acPoolPair?.symbol).toBe('A-C') - expect(acPoolPair?.name).toBe('A-C') + expect(acPoolPair?.symbol).toStrictEqual('A-C') + expect(acPoolPair?.name).toStrictEqual('A-C') const bcPoolPair = await cache.get('B-C') - expect(bcPoolPair?.symbol).toBe('B-C') - expect(bcPoolPair?.name).toBe('B-C') + expect(bcPoolPair?.symbol).toStrictEqual('B-C') + expect(bcPoolPair?.name).toStrictEqual('B-C') }) diff --git a/src/module.api/cache/token.info.cache.spec.ts b/src/module.api/cache/token.info.cache.spec.ts index 45a202672..37658a3bf 100644 --- a/src/module.api/cache/token.info.cache.spec.ts +++ b/src/module.api/cache/token.info.cache.spec.ts @@ -40,18 +40,18 @@ beforeAll(async () => { it('should get from cache via get as container RPC is killed', async () => { const dfi = await cache.get('0') - expect(dfi?.symbol).toBe('DFI') - expect(dfi?.name).toBe('Default Defi token') + expect(dfi?.symbol).toStrictEqual('DFI') + expect(dfi?.name).toStrictEqual('Default Defi token') const tob = await cache.get('2') - expect(tob?.symbol).toBe('TOB') - expect(tob?.name).toBe('TOB') + expect(tob?.symbol).toStrictEqual('TOB') + expect(tob?.name).toStrictEqual('TOB') }) it('should get from cache via batch as container RPC is killed', async () => { const tokens = await cache.batch(['0', '1', '2', '3']) - expect(tokens['0'].symbol).toBe('DFI') - expect(tokens['1'].symbol).toBe('TOA') - expect(tokens['2'].symbol).toBe('TOB') - expect(tokens['3'].symbol).toBe('TOC') + expect(tokens['0'].symbol).toStrictEqual('DFI') + expect(tokens['1'].symbol).toStrictEqual('TOA') + expect(tokens['2'].symbol).toStrictEqual('TOB') + expect(tokens['3'].symbol).toStrictEqual('TOC') }) diff --git a/src/module.api/guards/network.guard.e2e.ts b/src/module.api/guards/network.guard.e2e.ts index 582e0d4b2..a26b80940 100644 --- a/src/module.api/guards/network.guard.e2e.ts +++ b/src/module.api/guards/network.guard.e2e.ts @@ -21,8 +21,8 @@ it('should 404 with invalid network', async () => { url: '/v1/mainnet/rpc/getblockchaininfo' }) - expect(res.statusCode).toBe(404) - expect(res.json()).toEqual({ + expect(res.statusCode).toStrictEqual(404) + expect(res.json()).toStrictEqual({ error: { code: 404, type: 'NotFound', diff --git a/src/module.api/health.e2e.ts b/src/module.api/health.e2e.ts index dca65127e..0cb44e911 100644 --- a/src/module.api/health.e2e.ts +++ b/src/module.api/health.e2e.ts @@ -26,8 +26,8 @@ describe('/_health/probes/liveness', () => { url: '/_health/probes/liveness' }) - expect(res.statusCode).toBe(200) - expect(res.json()).toEqual({ + expect(res.statusCode).toStrictEqual(200) + expect(res.json()).toStrictEqual({ details: { defid: { status: 'up' @@ -53,8 +53,8 @@ describe('/_health/probes/readiness', () => { url: '/_health/probes/readiness' }) - expect(res.statusCode).toBe(503) - expect(res.json()).toEqual({ + expect(res.statusCode).toStrictEqual(503) + expect(res.json()).toStrictEqual({ details: { defid: { blocks: expect.any(Number), diff --git a/src/module.api/poolpair.controller.spec.ts b/src/module.api/poolpair.controller.spec.ts index 001504777..b7663b657 100644 --- a/src/module.api/poolpair.controller.spec.ts +++ b/src/module.api/poolpair.controller.spec.ts @@ -79,10 +79,10 @@ describe('list', () => { size: 30 }) - expect(response.data.length).toBe(8) + expect(response.data.length).toStrictEqual(8) expect(response.page).toBeUndefined() - expect(response.data[1]).toEqual({ + expect(response.data[1]).toStrictEqual({ id: '8', symbol: 'A-C', name: 'A-C', @@ -114,24 +114,24 @@ describe('list', () => { const first = await controller.list({ size: 2 }) - expect(first.data.length).toBe(2) - expect(first.page?.next).toBe('8') - expect(first.data[0].symbol).toBe('A-B') - expect(first.data[1].symbol).toBe('A-C') + expect(first.data.length).toStrictEqual(2) + expect(first.page?.next).toStrictEqual('8') + expect(first.data[0].symbol).toStrictEqual('A-B') + expect(first.data[1].symbol).toStrictEqual('A-C') const next = await controller.list({ size: 10, next: first.page?.next }) - expect(next.data.length).toBe(6) + expect(next.data.length).toStrictEqual(6) expect(next.page?.next).toBeUndefined() - expect(next.data[0].symbol).toBe('A-D') - expect(next.data[1].symbol).toBe('A-E') - expect(next.data[2].symbol).toBe('A-F') - expect(next.data[3].symbol).toBe('B-C') - expect(next.data[4].symbol).toBe('B-D') - expect(next.data[5].symbol).toBe('B-E') + expect(next.data[0].symbol).toStrictEqual('A-D') + expect(next.data[1].symbol).toStrictEqual('A-E') + expect(next.data[2].symbol).toStrictEqual('A-F') + expect(next.data[3].symbol).toStrictEqual('B-C') + expect(next.data[4].symbol).toStrictEqual('B-D') + expect(next.data[5].symbol).toStrictEqual('B-E') }) it('should list with undefined next pagination', async () => { @@ -140,8 +140,8 @@ describe('list', () => { next: undefined }) - expect(first.data.length).toBe(2) - expect(first.page?.next).toBe('8') + expect(first.data.length).toStrictEqual(2) + expect(first.page?.next).toStrictEqual('8') }) }) @@ -149,7 +149,7 @@ describe('get', () => { it('should get', async () => { const response = await controller.get('7') - expect(response).toEqual({ + expect(response).toStrictEqual({ id: '7', symbol: 'A-B', name: 'A-B', diff --git a/src/module.api/rpc.controller.spec.ts b/src/module.api/rpc.controller.spec.ts index 189ccd439..6351b169d 100644 --- a/src/module.api/rpc.controller.spec.ts +++ b/src/module.api/rpc.controller.spec.ts @@ -28,5 +28,5 @@ beforeEach(async () => { it('should getblockchaininfo', async () => { const result = await controller.call('getblockchaininfo', undefined) - expect(result.chain).toBe('regtest') + expect(result.chain).toStrictEqual('regtest') }) diff --git a/src/module.api/tokens.controller.spec.ts b/src/module.api/tokens.controller.spec.ts index b180fa401..93ad4fcf9 100644 --- a/src/module.api/tokens.controller.spec.ts +++ b/src/module.api/tokens.controller.spec.ts @@ -34,7 +34,7 @@ beforeEach(async () => { describe('controller.list() for all tokens', () => { it('should listTokens', async () => { const result = await controller.list({ size: 100 }) - expect(result.data.length).toBe(4) + expect(result.data.length).toStrictEqual(4) expect(result.data[0]).toStrictEqual({ id: '0', @@ -136,8 +136,8 @@ describe('controller.list() for all tokens', () => { it('should listTokens with pagination', async () => { const first = await controller.list({ size: 2 }) - expect(first.data.length).toBe(2) - expect(first.page?.next).toBe('1') + expect(first.data.length).toStrictEqual(2) + expect(first.page?.next).toStrictEqual('1') expect(first.data[0]).toStrictEqual(expect.objectContaining({ id: '0', symbol: 'DFI', symbolKey: 'DFI' })) expect(first.data[1]).toStrictEqual(expect.objectContaining({ id: '1', symbol: 'DBTC', symbolKey: 'DBTC' })) @@ -147,8 +147,8 @@ describe('controller.list() for all tokens', () => { next: first.page?.next }) - expect(next.data.length).toBe(2) - expect(next.page?.next).toBe('3') + expect(next.data.length).toStrictEqual(2) + expect(next.page?.next).toStrictEqual('3') expect(next.data[0]).toStrictEqual(expect.objectContaining({ id: '2', symbol: 'DETH', symbolKey: 'DETH' })) expect(next.data[1]).toStrictEqual(expect.objectContaining({ id: '3', symbol: 'DBTC-DET', symbolKey: 'DBTC-DET' })) @@ -158,14 +158,14 @@ describe('controller.list() for all tokens', () => { next: next.page?.next }) - expect(last.data.length).toBe(0) + expect(last.data.length).toStrictEqual(0) expect(last.page).toBeUndefined() }) it('should listTokens with an empty object if size 100 next 300 which is out of range', async () => { const result = await controller.list({ size: 100, next: '300' }) - expect(result.data.length).toBe(0) + expect(result.data.length).toStrictEqual(0) expect(result.page).toBeUndefined() }) }) diff --git a/src/module.api/transactions.controller.spec.ts b/src/module.api/transactions.controller.spec.ts index 4c6cb33ff..623f1c706 100644 --- a/src/module.api/transactions.controller.spec.ts +++ b/src/module.api/transactions.controller.spec.ts @@ -58,8 +58,8 @@ describe('raw transactions test/send', () => { async function expectTxn (txid: string, amount: number, pubKey: Buffer): Promise { const details = await client.blockchain.getTxOut(txid, 0) - expect(details.value.toString(10)).toBe(amount.toString()) - expect(details.scriptPubKey.addresses[0]).toBe( + expect(details.value.toString(10)).toStrictEqual(amount.toString()) + expect(details.scriptPubKey.addresses[0]).toStrictEqual( Bech32.fromPubKey(pubKey, RegTest.bech32.hrp as HRP) ) } @@ -171,7 +171,7 @@ describe('estimate fee rate', () => { it('should have fee of 0.00005 and not 0.00005 after adding activity', async () => { const before = await controller.estimateFee(10) - expect(before).toBe(0.00005000) + expect(before).toStrictEqual(0.00005000) for (let i = 0; i < 10; i++) { for (let x = 0; x < 20; x++) { @@ -183,6 +183,6 @@ describe('estimate fee rate', () => { await container.generate(1) } const after = await controller.estimateFee(10) - expect(after).not.toBe(0.00005000) + expect(after).not.toStrictEqual(0.00005000) }) }) diff --git a/src/module.database/database.spec/specifications.ts b/src/module.database/database.spec/specifications.ts index 176d63297..720d2e12b 100644 --- a/src/module.database/database.spec/specifications.ts +++ b/src/module.database/database.spec/specifications.ts @@ -24,12 +24,12 @@ export async function teardown (database: Database): Promise { export async function shouldGetById (database: Database): Promise { for (const data of PARTITIONS) { const model = await database.get(PartitionMapping, data.id) - expect(model).toEqual(data) + expect(model).toStrictEqual(data) } for (const data of PARTITION_SORTS) { const model = await database.get(PartitionSortMapping, data.id) - expect(model).toEqual(data) + expect(model).toStrictEqual(data) } } @@ -37,13 +37,13 @@ export async function shouldGetByPartitionKey (database: Database): Promise { @@ -129,11 +129,11 @@ export async function shouldQueryPartitionSortPagination (database: Database): P limit: 2, order: SortOrder.DESC }) - expect(window43.length).toEqual(2) - expect(window43[0].a_partition).toEqual('1000') - expect(window43[0].a_sort).toEqual('2000') - expect(window43[1].a_partition).toEqual('1000') - expect(window43[1].a_sort).toEqual('1000') + expect(window43.length).toStrictEqual(2) + expect(window43[0].a_partition).toStrictEqual('1000') + expect(window43[0].a_sort).toStrictEqual('2000') + expect(window43[1].a_partition).toStrictEqual('1000') + expect(window43[1].a_sort).toStrictEqual('1000') const window32 = await database.query(PartitionSortMapping.index.composite_a, { partitionKey: '1000', @@ -141,11 +141,11 @@ export async function shouldQueryPartitionSortPagination (database: Database): P order: SortOrder.DESC, lt: window43[0].a_sort }) - expect(window32.length).toEqual(2) - expect(window32[0].a_partition).toEqual('1000') - expect(window32[0].a_sort).toEqual('1000') - expect(window32[1].a_partition).toEqual('1000') - expect(window32[1].a_sort).toEqual('0002') + expect(window32.length).toStrictEqual(2) + expect(window32[0].a_partition).toStrictEqual('1000') + expect(window32[0].a_sort).toStrictEqual('1000') + expect(window32[1].a_partition).toStrictEqual('1000') + expect(window32[1].a_sort).toStrictEqual('0002') const window21 = await database.query(PartitionSortMapping.index.composite_a, { partitionKey: '1000', @@ -153,11 +153,11 @@ export async function shouldQueryPartitionSortPagination (database: Database): P order: SortOrder.DESC, lt: window32[0].a_sort }) - expect(window21.length).toEqual(2) - expect(window21[0].a_partition).toEqual('1000') - expect(window21[0].a_sort).toEqual('0002') - expect(window21[1].a_partition).toEqual('1000') - expect(window21[1].a_sort).toEqual('0001') + expect(window21.length).toStrictEqual(2) + expect(window21[0].a_partition).toStrictEqual('1000') + expect(window21[0].a_sort).toStrictEqual('0002') + expect(window21[1].a_partition).toStrictEqual('1000') + expect(window21[1].a_sort).toStrictEqual('0001') const window11 = await database.query(PartitionSortMapping.index.composite_a, { partitionKey: '1000', @@ -165,9 +165,9 @@ export async function shouldQueryPartitionSortPagination (database: Database): P order: SortOrder.DESC, lt: window21[0].a_sort }) - expect(window11.length).toEqual(1) - expect(window11[0].a_partition).toEqual('1000') - expect(window11[0].a_sort).toEqual('0001') + expect(window11.length).toStrictEqual(1) + expect(window11[0].a_partition).toStrictEqual('1000') + expect(window11[0].a_sort).toStrictEqual('0001') } export async function shouldQueryKeySpaceWithoutColliding (database: Database): Promise { @@ -176,19 +176,19 @@ export async function shouldQueryKeySpaceWithoutColliding (database: Database): limit: 100, order: SortOrder.ASC }) - expect(all.length).toEqual(0) + expect(all.length).toStrictEqual(0) const slice = await database.query(PartitionSortMapping.index.composite_b, { partitionKey: 2000, limit: 100, order: SortOrder.ASC }) - expect(slice.length).toEqual(4) - expect(slice[0].b_partition).toEqual(2000) - expect(slice[0].b_sort).toEqual(1000) + expect(slice.length).toStrictEqual(4) + expect(slice[0].b_partition).toStrictEqual(2000) + expect(slice[0].b_sort).toStrictEqual(1000) - expect(slice[3].b_partition).toEqual(2000) - expect(slice[3].b_sort).toEqual(4000) + expect(slice[3].b_partition).toStrictEqual(2000) + expect(slice[3].b_sort).toStrictEqual(4000) } export async function shouldQueryWithAscDesc (database: Database): Promise { @@ -196,43 +196,43 @@ export async function shouldQueryWithAscDesc (database: Database): Promise limit: 100, order: SortOrder.DESC }) - expect(partitionADesc.length).toEqual(4) - expect(partitionADesc[0].a).toBe('0003') - expect(partitionADesc[1].a).toBe('0002') - expect(partitionADesc[2].a).toBe('0001') - expect(partitionADesc[3].a).toBe('0000') + expect(partitionADesc.length).toStrictEqual(4) + expect(partitionADesc[0].a).toStrictEqual('0003') + expect(partitionADesc[1].a).toStrictEqual('0002') + expect(partitionADesc[2].a).toStrictEqual('0001') + expect(partitionADesc[3].a).toStrictEqual('0000') const partitionAAsc = await database.query(PartitionMapping.index.partition_a, { limit: 100, order: SortOrder.ASC }) - expect(partitionAAsc.length).toEqual(4) - expect(partitionAAsc[0].a).toBe('0000') - expect(partitionAAsc[1].a).toBe('0001') - expect(partitionAAsc[2].a).toBe('0002') - expect(partitionAAsc[3].a).toBe('0003') + expect(partitionAAsc.length).toStrictEqual(4) + expect(partitionAAsc[0].a).toStrictEqual('0000') + expect(partitionAAsc[1].a).toStrictEqual('0001') + expect(partitionAAsc[2].a).toStrictEqual('0002') + expect(partitionAAsc[3].a).toStrictEqual('0003') const compositeBDesc = await database.query(PartitionSortMapping.index.composite_b, { partitionKey: 2000, limit: 100, order: SortOrder.DESC }) - expect(compositeBDesc.length).toEqual(4) - expect(compositeBDesc[0].b_sort).toBe(4000) - expect(compositeBDesc[1].b_sort).toBe(3000) - expect(compositeBDesc[2].b_sort).toBe(2000) - expect(compositeBDesc[3].b_sort).toBe(1000) + expect(compositeBDesc.length).toStrictEqual(4) + expect(compositeBDesc[0].b_sort).toStrictEqual(4000) + expect(compositeBDesc[1].b_sort).toStrictEqual(3000) + expect(compositeBDesc[2].b_sort).toStrictEqual(2000) + expect(compositeBDesc[3].b_sort).toStrictEqual(1000) const compositeBAsc = await database.query(PartitionSortMapping.index.composite_b, { partitionKey: 2000, limit: 100, order: SortOrder.ASC }) - expect(compositeBAsc.length).toEqual(4) - expect(compositeBAsc[0].b_sort).toBe(1000) - expect(compositeBAsc[1].b_sort).toBe(2000) - expect(compositeBAsc[2].b_sort).toBe(3000) - expect(compositeBAsc[3].b_sort).toBe(4000) + expect(compositeBAsc.length).toStrictEqual(4) + expect(compositeBAsc[0].b_sort).toStrictEqual(1000) + expect(compositeBAsc[1].b_sort).toStrictEqual(2000) + expect(compositeBAsc[2].b_sort).toStrictEqual(3000) + expect(compositeBAsc[3].b_sort).toStrictEqual(4000) } export async function shouldQueryWithOperatorGT (database: Database): Promise { @@ -242,10 +242,10 @@ export async function shouldQueryWithOperatorGT (database: Database): Promise { @@ -255,10 +255,10 @@ export async function shouldQueryWithOperatorGTE (database: Database): Promise { @@ -268,9 +268,9 @@ export async function shouldQueryWithOperatorLT (database: Database): Promise { @@ -280,10 +280,10 @@ export async function shouldQueryWithOperatorLTE (database: Database): Promise { @@ -294,9 +294,9 @@ export async function shouldQueryWithOperatorGTLT (database: Database): Promise< gt: 1000, lt: 4000 }) - expect(slice.length).toEqual(2) - expect(slice[0].b_sort).toEqual(2000) - expect(slice[1].b_sort).toEqual(3000) + expect(slice.length).toStrictEqual(2) + expect(slice[0].b_sort).toStrictEqual(2000) + expect(slice[1].b_sort).toStrictEqual(3000) } export async function shouldQueryWithOperatorGTELTE (database: Database): Promise { @@ -307,10 +307,10 @@ export async function shouldQueryWithOperatorGTELTE (database: Database): Promis gte: 1000, lte: 3000 }) - expect(slice.length).toEqual(3) - expect(slice[0].b_sort).toEqual(1000) - expect(slice[1].b_sort).toEqual(2000) - expect(slice[2].b_sort).toEqual(3000) + expect(slice.length).toStrictEqual(3) + expect(slice[0].b_sort).toStrictEqual(1000) + expect(slice[1].b_sort).toStrictEqual(2000) + expect(slice[2].b_sort).toStrictEqual(3000) } export async function shouldQueryWithOperatorGTLTE (database: Database): Promise { @@ -321,9 +321,9 @@ export async function shouldQueryWithOperatorGTLTE (database: Database): Promise gt: 1000, lte: 3000 }) - expect(slice.length).toEqual(2) - expect(slice[0].b_sort).toEqual(3000) - expect(slice[1].b_sort).toEqual(2000) + expect(slice.length).toStrictEqual(2) + expect(slice[0].b_sort).toStrictEqual(3000) + expect(slice[1].b_sort).toStrictEqual(2000) } export async function shouldQueryWithOperatorGTELT (database: Database): Promise { @@ -334,7 +334,7 @@ export async function shouldQueryWithOperatorGTELT (database: Database): Promise gte: 1000, lt: 3000 }) - expect(slice.length).toEqual(2) - expect(slice[0].b_sort).toEqual(1000) - expect(slice[1].b_sort).toEqual(2000) + expect(slice.length).toStrictEqual(2) + expect(slice[0].b_sort).toStrictEqual(1000) + expect(slice[1].b_sort).toStrictEqual(2000) } diff --git a/src/module.database/index.spec.ts b/src/module.database/index.spec.ts index b1e0d6852..557cd7019 100644 --- a/src/module.database/index.spec.ts +++ b/src/module.database/index.spec.ts @@ -21,13 +21,13 @@ describe('provided module: level', () => { }) it('dynamically injected database should be level database', () => { - expect(database instanceof LevelDatabase).toBe(true) + expect(database instanceof LevelDatabase).toStrictEqual(true) }) it('should be a singleton module', () => { const a = app.get(Database) const b = app.get(Database) - expect(a).toEqual(b) + expect(a).toStrictEqual(b) }) }) @@ -46,13 +46,13 @@ describe('provided module: memory', () => { }) it('dynamically injected database should be memory database', () => { - expect(database instanceof MemoryDatabase).toBe(true) + expect(database instanceof MemoryDatabase).toStrictEqual(true) }) it('should be a singleton module', () => { const a = app.get(Database) const b = app.get(Database) - expect(a).toEqual(b) + expect(a).toStrictEqual(b) }) }) diff --git a/src/module.indexer/indexer.spec/block.spec.ts b/src/module.indexer/indexer.spec/block.spec.ts index fd9eb09b1..f52434529 100644 --- a/src/module.indexer/indexer.spec/block.spec.ts +++ b/src/module.indexer/indexer.spec/block.spec.ts @@ -31,9 +31,9 @@ it('should wait for block 0', async () => { const blockMapper = app.get(BlockMapper) const block = await blockMapper.getByHeight(0) - expect(block?.height).toBe(0) - expect(block?.hash).toBe('0091f00915b263d08eba2091ba70ba40cea75242b3f51ea29f4a1b8d7814cd01') - expect(block?.stakeModifier).toBe('0000000000000000000000000000000000000000000000000000000000000000') + expect(block?.height).toStrictEqual(0) + expect(block?.hash).toStrictEqual('0091f00915b263d08eba2091ba70ba40cea75242b3f51ea29f4a1b8d7814cd01') + expect(block?.stakeModifier).toStrictEqual('0000000000000000000000000000000000000000000000000000000000000000') expect(block?.transactionCount).toBeGreaterThan(0) }) @@ -43,7 +43,7 @@ it('should wait for block 1', async () => { const blockMapper = app.get(BlockMapper) const block = await blockMapper.getByHeight(1) - expect(block?.height).toBe(1) + expect(block?.height).toStrictEqual(1) expect(block?.transactionCount).toBeGreaterThan(0) }) @@ -53,7 +53,7 @@ it('should wait for block 10', async () => { const blockMapper = app.get(BlockMapper) const block = await blockMapper.getByHeight(10) - expect(block?.height).toBe(10) + expect(block?.height).toStrictEqual(10) expect(block?.transactionCount).toBeGreaterThan(0) }) diff --git a/src/module.indexer/indexer.spec/script.spec.ts b/src/module.indexer/indexer.spec/script.spec.ts index e3e626882..d65260eac 100644 --- a/src/module.indexer/indexer.spec/script.spec.ts +++ b/src/module.indexer/indexer.spec/script.spec.ts @@ -34,9 +34,9 @@ async function expectActivities (scriptHex: string): Promise { const activities = await activityMapper.query(hid, 100) for (const item of activities) { - expect(item.hid).toBe(hid) - expect(item.vout?.txid).toBe(item.txid) - expect(item.script.hex).toBe(scriptHex) + expect(item.hid).toStrictEqual(hid) + expect(item.vout?.txid).toStrictEqual(item.txid) + expect(item.script.hex).toStrictEqual(scriptHex) expect(Number.parseFloat(item.value)).toBeGreaterThanOrEqual(0) } } @@ -47,7 +47,7 @@ async function expectUnspent (scriptHex: string): Promise { const unspent = await unspentMapper.query(hid, 100) for (const item of unspent) { - expect(item.script.hex).toBe(scriptHex) + expect(item.script.hex).toStrictEqual(scriptHex) expect(Number.parseFloat(item.vout.value)).toBeGreaterThanOrEqual(0) } } @@ -64,17 +64,17 @@ it('should wait for block height 1', async () => { const aggregationMapper = app.get(ScriptAggregationMapper) const aggregation = await aggregationMapper.get(hid, 1) - expect(aggregation?.hid).toBe(hid) - expect(aggregation?.block.height).toBe(1) - expect(aggregation?.script.hex).toBe(scriptHex) + expect(aggregation?.hid).toStrictEqual(hid) + expect(aggregation?.block.height).toStrictEqual(1) + expect(aggregation?.script.hex).toStrictEqual(scriptHex) - expect(aggregation?.statistic.txCount).toBe(2) - expect(aggregation?.statistic.txInCount).toBe(2) - expect(aggregation?.statistic.txOutCount).toBe(0) + expect(aggregation?.statistic.txCount).toStrictEqual(2) + expect(aggregation?.statistic.txInCount).toStrictEqual(2) + expect(aggregation?.statistic.txOutCount).toStrictEqual(0) - expect(aggregation?.amount.txOut).toBe('0.00000000') - expect(aggregation?.amount.txIn).toBe('48.00000000') - expect(aggregation?.amount.unspent).toBe('48.00000000') + expect(aggregation?.amount.txOut).toStrictEqual('0.00000000') + expect(aggregation?.amount.txIn).toStrictEqual('48.00000000') + expect(aggregation?.amount.unspent).toStrictEqual('48.00000000') }) it('should wait for block height 2', async () => { @@ -89,17 +89,17 @@ it('should wait for block height 2', async () => { const aggregationMapper = app.get(ScriptAggregationMapper) const aggregation = await aggregationMapper.get(hid, 2) - expect(aggregation?.hid).toBe(hid) - expect(aggregation?.block.height).toBe(2) - expect(aggregation?.script.hex).toBe(scriptHex) + expect(aggregation?.hid).toStrictEqual(hid) + expect(aggregation?.block.height).toStrictEqual(2) + expect(aggregation?.script.hex).toStrictEqual(scriptHex) - expect(aggregation?.statistic.txCount).toBe(1) - expect(aggregation?.statistic.txInCount).toBe(1) - expect(aggregation?.statistic.txOutCount).toBe(0) + expect(aggregation?.statistic.txCount).toStrictEqual(1) + expect(aggregation?.statistic.txInCount).toStrictEqual(1) + expect(aggregation?.statistic.txOutCount).toStrictEqual(0) - expect(aggregation?.amount.txOut).toBe('0.00000000') - expect(aggregation?.amount.txIn).toBe('38.00000000') - expect(aggregation?.amount.unspent).toBe('38.00000000') + expect(aggregation?.amount.txOut).toStrictEqual('0.00000000') + expect(aggregation?.amount.txIn).toStrictEqual('38.00000000') + expect(aggregation?.amount.unspent).toStrictEqual('38.00000000') }) it('should wait for block height 3', async () => { @@ -114,15 +114,15 @@ it('should wait for block height 3', async () => { const aggregationMapper = app.get(ScriptAggregationMapper) const aggregation = await aggregationMapper.get(hid, 3) - expect(aggregation?.hid).toBe(hid) - expect(aggregation?.block.height).toBe(3) - expect(aggregation?.script.hex).toBe(scriptHex) + expect(aggregation?.hid).toStrictEqual(hid) + expect(aggregation?.block.height).toStrictEqual(3) + expect(aggregation?.script.hex).toStrictEqual(scriptHex) - expect(aggregation?.statistic.txCount).toBe(2) - expect(aggregation?.statistic.txInCount).toBe(2) - expect(aggregation?.statistic.txOutCount).toBe(0) + expect(aggregation?.statistic.txCount).toStrictEqual(2) + expect(aggregation?.statistic.txInCount).toStrictEqual(2) + expect(aggregation?.statistic.txOutCount).toStrictEqual(0) - expect(aggregation?.amount.txOut).toBe('0.00000000') - expect(aggregation?.amount.txIn).toBe('76.00000000') - expect(aggregation?.amount.unspent).toBe('76.00000000') + expect(aggregation?.amount.txOut).toStrictEqual('0.00000000') + expect(aggregation?.amount.txIn).toStrictEqual('76.00000000') + expect(aggregation?.amount.unspent).toStrictEqual('76.00000000') }) diff --git a/src/module.indexer/indexer.spec/transaction.spec.ts b/src/module.indexer/indexer.spec/transaction.spec.ts index bc0cbfce5..6a78da8ef 100644 --- a/src/module.indexer/indexer.spec/transaction.spec.ts +++ b/src/module.indexer/indexer.spec/transaction.spec.ts @@ -34,17 +34,17 @@ async function expectTransactions (hash: string, count: number): Promise { const voutMapper = app.get(TransactionVoutMapper) const transactions = await transactionMapper.queryByBlockHash(hash, 100) - expect(transactions.length).toBe(count) + expect(transactions.length).toStrictEqual(count) for (const transaction of transactions) { - expect(transaction.block.hash).toBe(hash) + expect(transaction.block.hash).toStrictEqual(hash) for (const vin of await vinMapper.query(transaction.txid, 100)) { - expect(vin.txid).toBe(transaction.txid) + expect(vin.txid).toStrictEqual(transaction.txid) } for (const vout of await voutMapper.query(transaction.txid, 100)) { - expect(vout.txid).toBe(transaction.txid) + expect(vout.txid).toStrictEqual(transaction.txid) expect(vout.n).toBeGreaterThanOrEqual(0) expect(vout.script.hex).toBeDefined() expect(Number.parseFloat(vout.value)).toBeGreaterThanOrEqual(0) diff --git a/src/module.model/_hex.encoder.spec.ts b/src/module.model/_hex.encoder.spec.ts index 4d8c0a763..6ae51ed24 100644 --- a/src/module.model/_hex.encoder.spec.ts +++ b/src/module.model/_hex.encoder.spec.ts @@ -2,16 +2,16 @@ import { HexEncoder } from '@src/module.model/_hex.encoder' it('should encode script hex', () => { const hex = HexEncoder.asSHA256('1600140e7c0ab18b305bc987a266dc06de26fcfab4b56a') - expect(hex).toBe('3d78c27dffed5c633ec8cb3c1bab3aec7c63ff9247cd2a7646f98e4f7075cca0') - expect(hex.length).toBe(64) + expect(hex).toStrictEqual('3d78c27dffed5c633ec8cb3c1bab3aec7c63ff9247cd2a7646f98e4f7075cca0') + expect(hex.length).toStrictEqual(64) }) it('should encode height', () => { - expect(HexEncoder.encodeHeight(0)).toBe('00000000') - expect(HexEncoder.encodeHeight(1)).toBe('00000001') - expect(HexEncoder.encodeHeight(255)).toBe('000000ff') - expect(HexEncoder.encodeHeight(256)).toBe('00000100') - expect(HexEncoder.encodeHeight(4294967295)).toBe('ffffffff') + expect(HexEncoder.encodeHeight(0)).toStrictEqual('00000000') + expect(HexEncoder.encodeHeight(1)).toStrictEqual('00000001') + expect(HexEncoder.encodeHeight(255)).toStrictEqual('000000ff') + expect(HexEncoder.encodeHeight(256)).toStrictEqual('00000100') + expect(HexEncoder.encodeHeight(4294967295)).toStrictEqual('ffffffff') expect(() => { HexEncoder.encodeHeight(4294967296) @@ -19,11 +19,11 @@ it('should encode height', () => { }) it('should encode vout index', () => { - expect(HexEncoder.encodeVoutIndex(0)).toBe('00000000') - expect(HexEncoder.encodeVoutIndex(1)).toBe('00000001') - expect(HexEncoder.encodeVoutIndex(255)).toBe('000000ff') - expect(HexEncoder.encodeVoutIndex(256)).toBe('00000100') - expect(HexEncoder.encodeVoutIndex(4294967295)).toBe('ffffffff') + expect(HexEncoder.encodeVoutIndex(0)).toStrictEqual('00000000') + expect(HexEncoder.encodeVoutIndex(1)).toStrictEqual('00000001') + expect(HexEncoder.encodeVoutIndex(255)).toStrictEqual('000000ff') + expect(HexEncoder.encodeVoutIndex(256)).toStrictEqual('00000100') + expect(HexEncoder.encodeVoutIndex(4294967295)).toStrictEqual('ffffffff') expect(() => { HexEncoder.encodeVoutIndex(4294967296) diff --git a/src/module.model/block.spec.ts b/src/module.model/block.spec.ts index cbc09152f..31db44156 100644 --- a/src/module.model/block.spec.ts +++ b/src/module.model/block.spec.ts @@ -56,31 +56,31 @@ afterEach(async () => { it('should getByHash', async () => { const block = await mapper.getByHash('1000000000000000000000000000000000000000000000000000000000000000') - expect(block?.height).toBe(1) + expect(block?.height).toStrictEqual(1) }) it('should getByHeight', async () => { const block = await mapper.getByHeight(0) - expect(block?.hash).toBe('0000000000000000000000000000000000000000000000000000000000000000') + expect(block?.hash).toStrictEqual('0000000000000000000000000000000000000000000000000000000000000000') }) it('should getHighest', async () => { const block = await mapper.getHighest() - expect(block?.height).toBe(2) - expect(block?.hash).toBe('1000000000000000000000000000000010000000000000000000000000000000') + expect(block?.height).toStrictEqual(2) + expect(block?.hash).toStrictEqual('1000000000000000000000000000000010000000000000000000000000000000') }) it('should queryByHeight', async () => { const blocks = await mapper.queryByHeight(10) - expect(blocks.length).toBe(3) + expect(blocks.length).toStrictEqual(3) - expect(blocks[0].height).toBe(2) - expect(blocks[1].height).toBe(1) - expect(blocks[2].height).toBe(0) + expect(blocks[0].height).toStrictEqual(2) + expect(blocks[1].height).toStrictEqual(1) + expect(blocks[2].height).toStrictEqual(0) const after2 = await mapper.queryByHeight(10, 2) - expect(after2[0].height).toBe(1) - expect(after2[1].height).toBe(0) + expect(after2[0].height).toStrictEqual(1) + expect(after2[1].height).toStrictEqual(0) }) it('should put', async () => { @@ -90,7 +90,7 @@ it('should put', async () => { await mapper.put(block) const updated = await mapper.getByHeight(0) - expect(updated?.size).toBe(100) + expect(updated?.size).toStrictEqual(100) }) it('should put but deleted', async () => { diff --git a/src/module.model/raw.block.spec.ts b/src/module.model/raw.block.spec.ts index 1e97ce315..e8eb3e17c 100644 --- a/src/module.model/raw.block.spec.ts +++ b/src/module.model/raw.block.spec.ts @@ -32,7 +32,7 @@ it('should put from defid and get back same object from mapper', async () => { await mapper.put(block) const saved = await mapper.get(hash) - expect(saved).toEqual(block) + expect(saved).toStrictEqual(block) }) it('should delete and be deleted', async () => { diff --git a/src/module.model/script.activity.spec.ts b/src/module.model/script.activity.spec.ts index f6b4f6131..137c76ea6 100644 --- a/src/module.model/script.activity.spec.ts +++ b/src/module.model/script.activity.spec.ts @@ -57,19 +57,19 @@ it('should query', async () => { const hid = HexEncoder.asSHA256(hex) const list = await mapper.query(hid, 10) - expect(list.length).toBe(4) + expect(list.length).toStrictEqual(4) - expect(list[0].block.height).toBe(1) - expect(list[0].typeHex).toBe('01') + expect(list[0].block.height).toStrictEqual(1) + expect(list[0].typeHex).toStrictEqual('01') - expect(list[1].block.height).toBe(1) - expect(list[1].typeHex).toBe('00') + expect(list[1].block.height).toStrictEqual(1) + expect(list[1].typeHex).toStrictEqual('00') - expect(list[2].block.height).toBe(0) - expect(list[2].typeHex).toBe('01') + expect(list[2].block.height).toStrictEqual(0) + expect(list[2].typeHex).toStrictEqual('01') - expect(list[3].block.height).toBe(0) - expect(list[3].typeHex).toBe('00') + expect(list[3].block.height).toStrictEqual(0) + expect(list[3].typeHex).toStrictEqual('00') }) it('should delete', async () => { @@ -79,5 +79,5 @@ it('should delete', async () => { await mapper.delete(list[0].id) const deleted = await mapper.query(hid, 10) - expect(deleted.length).toBe(3) + expect(deleted.length).toStrictEqual(3) })