Skip to content

Commit

Permalink
test: coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed Jul 19, 2021
1 parent eddb0cb commit afe7b92
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To use this SDK, you first need login into to [blockfrost.io](https://blockfrost
The SDK is hosted on [npmjs.com](https://www.npmjs.com/package/@blockfrost/blockfrost-js), so you can directly import it using your favorite package manager.

```console
$ yarn add @blockfrost/blockfrost-js
yarn add @blockfrost/blockfrost-js
```

<br/>
Expand Down
18 changes: 18 additions & 0 deletions test/fixtures/endpoints/nutlink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { BlockFrostAPI } from '../../../src';

export default [
{
command: (SDK: BlockFrostAPI) =>
SDK.nutlinkAddress(
'addr1q85yx2w7ragn5sx6umgmtjpc3865s9sg59sz4rrh6f90kgwfwlzu3w8ttacqg89mkdgwshwnplj5c5n9f8dhp0h55q2q7qm63t',
),
response: {
address:
'addr1q85yx2w7ragn5sx6umgmtjpc3865s9sg59sz4rrh6f90kgwfwlzu3w8ttacqg89mkdgwshwnplj5c5n9f8dhp0h55q2q7qm63t',
metadata_url: 'https://nut.link/metadata.json',
metadata_hash:
'9586368825d39caf48bc64b2ca8a8db7bffa9227a5dad8464ce499be4516498f',
metadata: {},
},
},
] as const;
41 changes: 41 additions & 0 deletions test/fixtures/endpoints/pools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { BlockFrostAPI } from '../../../src';

export default [
{
command: (SDK: BlockFrostAPI) => SDK.poolsRetiring(),
response: expect.arrayContaining([
expect.objectContaining({
pool_id: expect.any(String),
epoch: expect.any(Number),
}),
]),
},
{
command: (SDK: BlockFrostAPI) => SDK.poolsRetired(),
response: expect.arrayContaining([
Expand All @@ -10,4 +19,36 @@ export default [
}),
]),
},
{
command: (SDK: BlockFrostAPI) => SDK.pools(),
response: expect.arrayContaining([expect.any(String)]),
},
{
command: (SDK: BlockFrostAPI) =>
SDK.poolsById('pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy'),
response: {
active_size: 0.0005204635040245651,
active_stake: '12072869068313',
blocks_minted: 1395,
declared_pledge: '510000000000',
fixed_cost: '340000000',
hex: '0f292fcaa02b8b2f9b3c8f9fd8e0bb21abedb692a6d5058df3ef2735',
live_delegators: 177,
live_pledge: '530658054312',
live_saturation: 0.17852990715072242,
live_size: 0.0005105586936083699,
live_stake: '11849864770069',
margin_cost: 0.049,
owners: ['stake1u98nnlkvkk23vtvf9273uq7cph5ww6u2yq2389psuqet90sv4xv9v'],
pool_id: 'pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy',
registration: [
'a96c79773b7506211eb56bf94886a2face17657d1009f52fb5ea05f19cc8823e',
],
retirement: [],
reward_account:
'stake1u98nnlkvkk23vtvf9273uq7cph5ww6u2yq2389psuqet90sv4xv9v',
vrf_key:
'b512cc7c1a8ba689c2d8fd27adfdbac2049a3f8f95c8b85e8298f14d7d8dc4e6',
},
},
] as const;
4 changes: 2 additions & 2 deletions test/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const handleError = [
host: 'cardano-mainnet.blockfrost.io',
protocol: 'https:',
},
toJSON: () => ({}),
toJSON: (): any => ({}),
response: undefined,
isAxiosError: true,
},
Expand All @@ -186,7 +186,7 @@ export const handleError = [
host: 'cardano-mainnet.blockfrost.io',
protocol: 'https:',
},
toJSON: () => ({
toJSON: (): any => ({
message: 'Custom message',
error: 'CustomError',
}),
Expand Down

0 comments on commit afe7b92

Please sign in to comment.