-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Breaking change from previously release, the returned values are not encapsulated in an .data field any longer.
- Loading branch information
Showing
3 changed files
with
54 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,35 @@ | ||
import { AxiosError } from 'axios'; | ||
import { Provider } from '../src/index.js'; | ||
import test from 'ava'; | ||
|
||
test('should verify that city chain network is correct', async (t) => { | ||
let provider = new Provider('https://city.indexer.blockcore.net'); | ||
const result: any = await provider.getSupply(); | ||
|
||
t.assert(result.data.total > 13759461317); // Previous test: 13762606311, API returns now: 13759461318 | ||
t.assert(result.data.rewards > 24854552); | ||
t.assert(result.data.height > 1338666); | ||
t.assert(result.total > 13759461317); // Previous test: 13762606311, API returns now: 13759461318 | ||
t.assert(result.rewards > 24854552); | ||
t.assert(result.height > 1338666); | ||
}); | ||
|
||
test('should get block by index', async (t) => { | ||
let provider = new Provider('https://city.indexer.blockcore.net'); | ||
const result: any = await provider.getBlockByIndex('1'); | ||
t.assert(result.data.blockHash === '10ff8948145eab119c528301e44316a977b6adb2d82526f44f296b02370a6d41'); | ||
t.assert(result.data.nonce === 16639); | ||
|
||
t.assert(result.blockHash === '10ff8948145eab119c528301e44316a977b6adb2d82526f44f296b02370a6d41'); | ||
t.assert(result.nonce === 16639); | ||
}); | ||
|
||
test('should get transaction by id', async (t) => { | ||
let provider = new Provider('https://city.indexer.blockcore.net'); | ||
const result: any = await provider.getTransactionById('f75756e8cd24e5c15c2f68a1a9eb2e6299ad8dd6e196940b27d8c933a1654c96'); // Block 50000 | ||
|
||
t.assert(result.data.symbol === 'CITY'); | ||
t.assert(result.data.blockHash === '3ef76cbcd4c125bfab252f20e11cdec64a495b1c3d6caa77d407f1e0420f71e7'); | ||
t.assert(result.data.blockIndex === 50000); | ||
t.assert(result.data.transactionId === 'f75756e8cd24e5c15c2f68a1a9eb2e6299ad8dd6e196940b27d8c933a1654c96'); | ||
t.assert(result.symbol === 'CITY'); | ||
t.assert(result.blockHash === '3ef76cbcd4c125bfab252f20e11cdec64a495b1c3d6caa77d407f1e0420f71e7'); | ||
t.assert(result.blockIndex === 50000); | ||
t.assert(result.transactionId === 'f75756e8cd24e5c15c2f68a1a9eb2e6299ad8dd6e196940b27d8c933a1654c96'); | ||
}); | ||
|
||
test('should test if getEstimateRewards method returns a number', async (t) => { | ||
let provider = new Provider('https://city.indexer.blockcore.net'); | ||
const result: any = await provider.getEstimateRewards(); | ||
t.truthy(result); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters