fix: missing basic validation in route params #722
Annotations
16 errors and 1 warning
test/routes/token.test.ts > `/token/generate` - without params:
test/routes/token.test.ts#L35
Error: Snapshot ``/token/generate` - without params 1` mismatched
- Expected
+ Received
- "[
- {
- "code": "invalid_type",
- "expected": "object",
- "received": "null",
- "path": [],
- "message": "Expected object, received null"
- }
- ]"
+ "Invalid : Expected object, received null"
❯ test/routes/token.test.ts:35:24
|
test/routes/bitcoin/address.test.ts > /bitcoin/v1/address > Get address unspent transaction outputs:
test/routes/bitcoin/address.test.ts#L129
AssertionError: expected [ { …(4) }, { …(4) }, { …(4) }, …(14) ] to match object [ { …(4) }, { …(4) }, { …(4) }, …(12) ]
- Expected
+ Received
Array [
Object {
"status": Object {
+ "block_hash": "000000000000001d4c78f85fd7fda56916f448bb25f4b3b275f1cf6634e17bf8",
+ "block_height": 2812535,
+ "block_time": 1715047029,
+ "confirmed": false,
+ },
+ "txid": "989f4e03179e17cbb6edd446f57ea6107a40ba23441056653f1cc34b7dd1e5ba",
+ "value": 546,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
+ "block_hash": "000000000000001496bd5ab5f0c5cc6a46652f13ab60d20c2767beefe8d2391a",
+ "block_height": 2814587,
+ "block_time": 1715338294,
+ "confirmed": false,
+ },
+ "txid": "aab2d8fc3f064087450057ccb6012893cf219043d8c915fe64c5322c0eeb6fd2",
+ "value": 880,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
"block_hash": "00000000000000090eca5064939d4e2a20fe072e5b48815a08055ef7c2be7986",
"block_height": 2818025,
"block_time": 1716792964,
"confirmed": true,
},
"txid": "2478902e01d85aa04fea79efa89f3cd4b9d86ac66b1276d89c844076906c6a44",
"value": 89888317,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "00000000000000000b871290b8d050dc6b57104deada7f6c26d59d567c7ac94a",
"block_height": 2585022,
"block_time": 1712125215,
"confirmed": true,
},
"txid": "0c05a2ba51c6284eb1411bd7d49df455da97a482a8ce47266b50a4d3d857ee29",
"value": 546,
"vout": 2,
},
Object {
"status": Object {
"block_hash": "000000000000009de2006782c905136c925bbb4bb89e504e970affe1c20bbfee",
"block_height": 2811244,
"block_time": 1714790623,
"confirmed": true,
},
"txid": "0bd22675d00f3b958dd25cef3c6bf4df6a63511393ff59c959d158d1cf3626f4",
"value": 546,
"vout": 2,
},
Object {
"status": Object {
"block_hash": "000000000000000d53d74e0d8ae89528145d52c4e94bd9a6f25503f821701343",
"block_height": 2818192,
"block_time": 1716870027,
"confirmed": true,
},
"txid": "37849336280a290998afa9614afac39a640898f607eed7cbaed638daeb0f023a",
"value": 849120,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "000000000000000cb1c4d274f92a59a0e73cd99cec4a91f4deb7702f0d028b22",
"block_height": 2814568,
"block_time": 1715333489,
"confirmed": true,
},
"txid": "e905a6e466bf7f06b8385b5cf21057697500faf12b39da7b127eba91bc61bc3a",
"value": 880,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "00000000000000074d01a1844db22ada24e70043bac0d05a83aa2234cd5c3de9",
"block_height": 2817185,
"block_time": 1716459057,
"confirmed": true,
},
"txid": "ed1a688bc23811a386cb517f7430701e7f3a059e88eff184a237168a79fb8a8c",
"value": 546,
"vout": 0,
},
Object {
"status": Object {
"block_hash": "0000000000000007270b0f8be9b3b61c49a09dd7af0bb0f800aef8dbbf594e35",
"block_height": 2816698,
"block_time": 1716276487,
"confirmed": true,
},
"txid": "3ef5c0de31f0fdf051cf5658ad278b6726839dcb16996b530e719104f4c0189b",
"value": 546,
"vout": 0,
},
Object {
"status": Object {
"block_hash": "0000000000000365f0619dc58091519f4e7bdddc44b3b10f0a4ccfa668da1a31",
"block_height": 2585023,
"block_time": 1712126418,
"confirmed": true,
},
"txid": "057d3146e3ad62b82ac33c4a39c4aca5e21c2c8770dd8c9e6dc1dcf05dd2d4bb",
"value": 546,
"vout": 2,
},
Object {
"status": Object {
"block_hash": "0000000000000007270b0f8be9b3b61c49a09dd7af0bb0f800aef8dbbf594e35",
"block_height": 2816698,
"block_time": 1716276487,
"confirmed": true,
},
"txid": "f7b43efe2d16d6bf352a774478f26589408af010e874598bf7524973ad6147b2",
"value": 546,
"vout": 0,
},
|
test/routes/bitcoin/address.test.ts > /bitcoin/v1/address > Get address unspent transaction outputs with onlyNonRgbppUtxos = true:
test/routes/bitcoin/address.test.ts#L237
AssertionError: expected [ { …(4) }, { …(4) }, { …(4) }, …(2) ] to match object [ { …(4) }, { …(4) }, { …(4) } ]
- Expected
+ Received
Array [
Object {
"status": Object {
+ "block_hash": "000000000000001d4c78f85fd7fda56916f448bb25f4b3b275f1cf6634e17bf8",
+ "block_height": 2812535,
+ "block_time": 1715047029,
+ "confirmed": false,
+ },
+ "txid": "989f4e03179e17cbb6edd446f57ea6107a40ba23441056653f1cc34b7dd1e5ba",
+ "value": 546,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
+ "block_hash": "000000000000001496bd5ab5f0c5cc6a46652f13ab60d20c2767beefe8d2391a",
+ "block_height": 2814587,
+ "block_time": 1715338294,
+ "confirmed": false,
+ },
+ "txid": "aab2d8fc3f064087450057ccb6012893cf219043d8c915fe64c5322c0eeb6fd2",
+ "value": 880,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
"block_hash": "00000000000000090eca5064939d4e2a20fe072e5b48815a08055ef7c2be7986",
"block_height": 2818025,
"block_time": 1716792964,
"confirmed": true,
},
"txid": "2478902e01d85aa04fea79efa89f3cd4b9d86ac66b1276d89c844076906c6a44",
"value": 89888317,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "000000000000000d53d74e0d8ae89528145d52c4e94bd9a6f25503f821701343",
"block_height": 2818192,
"block_time": 1716870027,
"confirmed": true,
},
"txid": "37849336280a290998afa9614afac39a640898f607eed7cbaed638daeb0f023a",
"value": 849120,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "000000000000000cb1c4d274f92a59a0e73cd99cec4a91f4deb7702f0d028b22",
"block_height": 2814568,
"block_time": 1715333489,
"confirmed": true,
},
"txid": "e905a6e466bf7f06b8385b5cf21057697500faf12b39da7b127eba91bc61bc3a",
"value": 880,
"vout": 1,
},
]
❯ test/routes/bitcoin/address.test.ts:237:18
|
test/routes/rgbpp/address.test.ts > /:btc_address/balance - without pending_amount:
test/routes/rgbpp/address.test.ts#L78
AssertionError: expected 400 to be 200 // Object.is equality
- Expected
+ Received
- 200
+ 400
❯ test/routes/rgbpp/address.test.ts:78:33
|
test/routes/rgbpp/address.test.ts > /:btc_address/balance - with pending_amount:
test/routes/rgbpp/address.test.ts#L158
AssertionError: expected "getPendingOutputCellsByTxid" to be called 2 times, but got 0 times
❯ test/routes/rgbpp/address.test.ts:158:44
|
test/routes/rgbpp/transaction.test.ts > Post transaction with Invalid ckb_virtual_result JSON string:
test/routes/rgbpp/transaction.test.ts#L153
AssertionError: expected 500 to be 400 // Object.is equality
- Expected
+ Received
- 400
+ 500
❯ test/routes/rgbpp/transaction.test.ts:153:33
|
test (mempool)
Process completed with exit code 1.
|
test (electrs)
The job was canceled because "mempool" failed.
|
test/routes/token.test.ts > `/token/generate` - without params:
test/routes/token.test.ts#L35
Error: Snapshot ``/token/generate` - without params 1` mismatched
- Expected
+ Received
- "[
- {
- "code": "invalid_type",
- "expected": "object",
- "received": "null",
- "path": [],
- "message": "Expected object, received null"
- }
- ]"
+ "Invalid : Expected object, received null"
❯ test/routes/token.test.ts:35:24
|
test/services/transaction.test.ts > transactionProcessor > enqueueTransaction: should be add transaction request to queue:
test/services/transaction.test.ts#L130
AssertionError: expected 2 to be 1 // Object.is equality
- Expected
+ Received
- 1
+ 2
❯ test/services/transaction.test.ts:130:27
|
test/routes/bitcoin/address.test.ts > /bitcoin/v1/address > Get address unspent transaction outputs:
test/routes/bitcoin/address.test.ts#L129
AssertionError: expected [ { …(4) }, { …(4) }, { …(4) }, …(14) ] to match object [ { …(4) }, { …(4) }, { …(4) }, …(12) ]
- Expected
+ Received
Array [
Object {
"status": Object {
+ "block_hash": "000000000000001d4c78f85fd7fda56916f448bb25f4b3b275f1cf6634e17bf8",
+ "block_height": 2812535,
+ "block_time": 1715047029,
+ "confirmed": false,
+ },
+ "txid": "989f4e03179e17cbb6edd446f57ea6107a40ba23441056653f1cc34b7dd1e5ba",
+ "value": 546,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
+ "block_hash": "000000000000001496bd5ab5f0c5cc6a46652f13ab60d20c2767beefe8d2391a",
+ "block_height": 2814587,
+ "block_time": 1715338294,
+ "confirmed": false,
+ },
+ "txid": "aab2d8fc3f064087450057ccb6012893cf219043d8c915fe64c5322c0eeb6fd2",
+ "value": 880,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
"block_hash": "00000000000000090eca5064939d4e2a20fe072e5b48815a08055ef7c2be7986",
"block_height": 2818025,
"block_time": 1716792964,
"confirmed": true,
},
"txid": "2478902e01d85aa04fea79efa89f3cd4b9d86ac66b1276d89c844076906c6a44",
"value": 89888317,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "00000000000000000b871290b8d050dc6b57104deada7f6c26d59d567c7ac94a",
"block_height": 2585022,
"block_time": 1712125215,
"confirmed": true,
},
"txid": "0c05a2ba51c6284eb1411bd7d49df455da97a482a8ce47266b50a4d3d857ee29",
"value": 546,
"vout": 2,
},
Object {
"status": Object {
"block_hash": "000000000000009de2006782c905136c925bbb4bb89e504e970affe1c20bbfee",
"block_height": 2811244,
"block_time": 1714790623,
"confirmed": true,
},
"txid": "0bd22675d00f3b958dd25cef3c6bf4df6a63511393ff59c959d158d1cf3626f4",
"value": 546,
"vout": 2,
},
Object {
"status": Object {
"block_hash": "000000000000000d53d74e0d8ae89528145d52c4e94bd9a6f25503f821701343",
"block_height": 2818192,
"block_time": 1716870027,
"confirmed": true,
},
"txid": "37849336280a290998afa9614afac39a640898f607eed7cbaed638daeb0f023a",
"value": 849120,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "000000000000000cb1c4d274f92a59a0e73cd99cec4a91f4deb7702f0d028b22",
"block_height": 2814568,
"block_time": 1715333489,
"confirmed": true,
},
"txid": "e905a6e466bf7f06b8385b5cf21057697500faf12b39da7b127eba91bc61bc3a",
"value": 880,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "00000000000000074d01a1844db22ada24e70043bac0d05a83aa2234cd5c3de9",
"block_height": 2817185,
"block_time": 1716459057,
"confirmed": true,
},
"txid": "ed1a688bc23811a386cb517f7430701e7f3a059e88eff184a237168a79fb8a8c",
"value": 546,
"vout": 0,
},
Object {
"status": Object {
"block_hash": "0000000000000007270b0f8be9b3b61c49a09dd7af0bb0f800aef8dbbf594e35",
"block_height": 2816698,
"block_time": 1716276487,
"confirmed": true,
},
"txid": "3ef5c0de31f0fdf051cf5658ad278b6726839dcb16996b530e719104f4c0189b",
"value": 546,
"vout": 0,
},
Object {
"status": Object {
"block_hash": "0000000000000365f0619dc58091519f4e7bdddc44b3b10f0a4ccfa668da1a31",
"block_height": 2585023,
"block_time": 1712126418,
"confirmed": true,
},
"txid": "057d3146e3ad62b82ac33c4a39c4aca5e21c2c8770dd8c9e6dc1dcf05dd2d4bb",
"value": 546,
"vout": 2,
},
Object {
"status": Object {
"block_hash": "0000000000000007270b0f8be9b3b61c49a09dd7af0bb0f800aef8dbbf594e35",
"block_height": 2816698,
"block_time": 1716276487,
"confirmed": true,
},
"txid": "f7b43efe2d16d6bf352a774478f26589408af010e874598bf7524973ad6147b2",
"value": 546,
"vout": 0,
},
|
test/routes/bitcoin/address.test.ts > /bitcoin/v1/address > Get address unspent transaction outputs with onlyNonRgbppUtxos = true:
test/routes/bitcoin/address.test.ts#L237
AssertionError: expected [ { …(4) }, { …(4) }, { …(4) }, …(2) ] to match object [ { …(4) }, { …(4) }, { …(4) } ]
- Expected
+ Received
Array [
Object {
"status": Object {
+ "block_hash": "000000000000001d4c78f85fd7fda56916f448bb25f4b3b275f1cf6634e17bf8",
+ "block_height": 2812535,
+ "block_time": 1715047029,
+ "confirmed": false,
+ },
+ "txid": "989f4e03179e17cbb6edd446f57ea6107a40ba23441056653f1cc34b7dd1e5ba",
+ "value": 546,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
+ "block_hash": "000000000000001496bd5ab5f0c5cc6a46652f13ab60d20c2767beefe8d2391a",
+ "block_height": 2814587,
+ "block_time": 1715338294,
+ "confirmed": false,
+ },
+ "txid": "aab2d8fc3f064087450057ccb6012893cf219043d8c915fe64c5322c0eeb6fd2",
+ "value": 880,
+ "vout": 1,
+ },
+ Object {
+ "status": Object {
"block_hash": "00000000000000090eca5064939d4e2a20fe072e5b48815a08055ef7c2be7986",
"block_height": 2818025,
"block_time": 1716792964,
"confirmed": true,
},
"txid": "2478902e01d85aa04fea79efa89f3cd4b9d86ac66b1276d89c844076906c6a44",
"value": 89888317,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "000000000000000d53d74e0d8ae89528145d52c4e94bd9a6f25503f821701343",
"block_height": 2818192,
"block_time": 1716870027,
"confirmed": true,
},
"txid": "37849336280a290998afa9614afac39a640898f607eed7cbaed638daeb0f023a",
"value": 849120,
"vout": 1,
},
Object {
"status": Object {
"block_hash": "000000000000000cb1c4d274f92a59a0e73cd99cec4a91f4deb7702f0d028b22",
"block_height": 2814568,
"block_time": 1715333489,
"confirmed": true,
},
"txid": "e905a6e466bf7f06b8385b5cf21057697500faf12b39da7b127eba91bc61bc3a",
"value": 880,
"vout": 1,
},
]
❯ test/routes/bitcoin/address.test.ts:237:18
|
test/routes/rgbpp/address.test.ts > /:btc_address/balance - without pending_amount:
test/routes/rgbpp/address.test.ts#L78
AssertionError: expected 400 to be 200 // Object.is equality
- Expected
+ Received
- 200
+ 400
❯ test/routes/rgbpp/address.test.ts:78:33
|
test/routes/rgbpp/address.test.ts > /:btc_address/balance - with pending_amount:
test/routes/rgbpp/address.test.ts#L158
AssertionError: expected "getPendingOutputCellsByTxid" to be called 2 times, but got 0 times
❯ test/routes/rgbpp/address.test.ts:158:44
|
test/routes/rgbpp/transaction.test.ts > Post transaction with Invalid ckb_virtual_result JSON string:
test/routes/rgbpp/transaction.test.ts#L153
AssertionError: expected 500 to be 400 // Object.is equality
- Expected
+ Received
- 400
+ 500
❯ test/routes/rgbpp/transaction.test.ts:153:33
|
test (electrs)
Process completed with exit code 1.
|
test (mempool)
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/setup-node@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|