Skip to content

Commit

Permalink
test: 404 on block
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Dec 19, 2023
1 parent bb936aa commit c2a8711
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/tests/tx-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3344,12 +3344,12 @@ describe('tx tests', () => {
})
.build()
);
const result = await supertest(api.server).get(
let result = await supertest(api.server).get(
`/extended/v2/blocks/0x00000000000000000001e2ee7f0c6bd5361b5e7afd76156ca7d6f524ee5ca3d8/transactions?limit=20&offset=0`
);
expect(result.status).toBe(200);
expect(result.type).toBe('application/json');
const json = JSON.parse(result.text);
let json = JSON.parse(result.text);
expect(json.total).toBe(2);
expect(json.results[0]).toStrictEqual({
anchor_mode: 'any',
Expand Down Expand Up @@ -3391,6 +3391,15 @@ describe('tx tests', () => {
tx_status: 'success',
tx_type: 'coinbase',
});

// Try a non-existent block
result = await supertest(api.server).get(
`/extended/v2/blocks/0x00000000000000000001e2ee7f0c6bd5361b5e7afd76156ca7d6f524ee999999/transactions?limit=20&offset=0`
);
expect(result.status).toBe(404);
expect(result.type).toBe('application/json');
json = JSON.parse(result.text);
expect(json.errors).toBe('Block not found');
});

test('fetch transactions from block', async () => {
Expand Down

0 comments on commit c2a8711

Please sign in to comment.