Skip to content

Commit

Permalink
Test coverage (#127)
Browse files Browse the repository at this point in the history
* test: scripts

* test: more coverage
  • Loading branch information
vladimirvolek committed Sep 15, 2021
1 parent 9c33acb commit 449e397
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/badge-coverage.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions test/fixtures/endpoints/accounts.ts
Expand Up @@ -68,6 +68,19 @@ export default [
},
],
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsHistoryAll(
'stake1u9fzg77vrgfqlplkjqe9hntdcvsurpvxd60yp2fhn73002qsv9pdk',
),
response: expect.arrayContaining([
expect.objectContaining({
active_epoch: expect.any(Number),
amount: expect.any(String),
pool_id: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsDelegations(
Expand All @@ -82,6 +95,20 @@ export default [
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsDelegationsAll(
'stake1u9a3t4rgddm4expj0ucyxhxg3ft9ugk2ry6r9w69h04ea6cfj887f',
),
response: expect.arrayContaining([
expect.objectContaining({
amount: expect.any(String),
tx_hash: expect.any(String),
active_epoch: expect.any(Number),
pool_id: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsRegistrations(
Expand All @@ -94,6 +121,18 @@ export default [
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsRegistrationsAll(
'stake1u9a3t4rgddm4expj0ucyxhxg3ft9ugk2ry6r9w69h04ea6cfj887f',
),
response: expect.arrayContaining([
expect.objectContaining({
action: expect.any(String),
tx_hash: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsWithdrawals(
Expand Down Expand Up @@ -123,6 +162,18 @@ export default [
},
],
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsWithdrawalsAll(
'stake1u88xakeptjw9jwsytkjal76d07an4thvvrfx3w2kt77pw4sc5rr8k',
),
response: expect.arrayContaining([
expect.objectContaining({
tx_hash: expect.any(String),
amount: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsMirs(
Expand All @@ -137,6 +188,18 @@ export default [
},
],
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsMirsAll(
'stake1uyq7039vutuw8v7femqtktdu9zlhnqh3mkvvhdazft9ga2q8zdfkp',
),
response: expect.arrayContaining([
expect.objectContaining({
tx_hash: expect.any(String),
amount: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsAddresses(
Expand All @@ -148,6 +211,17 @@ export default [
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsAddressesAll(
'stake1u9a3t4rgddm4expj0ucyxhxg3ft9ugk2ry6r9w69h04ea6cfj887f',
),
response: expect.arrayContaining([
expect.objectContaining({
address: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsAddressesAssets(
Expand All @@ -172,4 +246,17 @@ export default [
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.accountsRewardsAll(
'stake1u8yk3dcuj8yylwvnzz953yups6mmuvt0vtjmxl2gmgceqjqz2yfd2',
),
response: expect.arrayContaining([
expect.objectContaining({
epoch: expect.any(Number),
amount: expect.any(String),
pool_id: expect.any(String),
}),
]),
},
] as const;
26 changes: 26 additions & 0 deletions test/fixtures/endpoints/addresses.ts
Expand Up @@ -47,4 +47,30 @@ export default [
// }),
// ]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.addressesTransactions(
'addr1qywvux9d5u4cqyzrhp587sty33gt5pl5hpxmnzrw5nk5j87fdzm3eywgf7uexyytfzfcrp4hhcck7ch9kd753k33jpyqa3mzep',
),
response: expect.arrayContaining([
expect.objectContaining({
tx_hash: expect.any(String),
tx_index: expect.any(Number),
block_height: expect.any(Number),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.addressesTransactionsAll(
'addr1qywvux9d5u4cqyzrhp587sty33gt5pl5hpxmnzrw5nk5j87fdzm3eywgf7uexyytfzfcrp4hhcck7ch9kd753k33jpyqa3mzep',
),
response: expect.arrayContaining([
expect.objectContaining({
tx_hash: expect.any(String),
tx_index: expect.any(Number),
block_height: expect.any(Number),
}),
]),
},
] as const;
38 changes: 38 additions & 0 deletions test/fixtures/endpoints/scripts.ts
@@ -0,0 +1,38 @@
import { BlockFrostAPI } from '../../../src';

export default [
{
command: (SDK: BlockFrostAPI) => SDK.scripts(),
response: expect.arrayContaining([
expect.objectContaining({
script_hash: expect.any(String),
}),
]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.script('4f590a3d80ae0312bad0b64d540c3ff5080e77250e9dbf5011630016'),
response: {
script_hash: '4f590a3d80ae0312bad0b64d540c3ff5080e77250e9dbf5011630016',
type: 'plutus',
serialised_size: 2739,
},
},
{
command: (SDK: BlockFrostAPI) =>
SDK.scriptRedeemers(
'4f590a3d80ae0312bad0b64d540c3ff5080e77250e9dbf5011630016',
),
response: [
{
fee: '212055687',
purpose: 'spend',
tx_hash:
'a95d16e891e51f98a3b1d3fe862ed355ebc8abffb7a7269d86f775553d9e653f',
tx_index: 0,
unit_mem: '520448',
unit_steps: '211535239',
},
],
},
] as const;

0 comments on commit 449e397

Please sign in to comment.