Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
siradji committed May 19, 2021
1 parent 2f1e637 commit 49e2a3f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
36 changes: 16 additions & 20 deletions packages/jellyfish-api-core/__tests__/category/blockchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,32 +317,28 @@ describe('masternode', () => {

describe('getBlockStats', () => {
it('should get blockchain stats and return all values', async () => {
const blockHash = await waitForBlockHash(1);
const stats = await client.blockchain.getBlockStats(blockHash);

const blockHash = await waitForBlockHash(1)
const stats = await client.blockchain.getBlockStats(blockHash)

expect(stats.height).toBeGreaterThanOrEqual(1);
expect(stats.minfee).toBeLessThanOrEqual(stats.medianfee);
expect(stats.medianfee).toBeLessThanOrEqual(stats.maxfee);
expect(stats.height).toBeGreaterThanOrEqual(1)
expect(stats.minfee).toBeLessThanOrEqual(stats.medianfee)
expect(stats.medianfee).toBeLessThanOrEqual(stats.maxfee)
})

it('should get blockchain stats with specific values', async () => {
const blockHash = await waitForBlockHash(1);
const stats = await client.blockchain.getBlockStats(blockHash, ["avgfee", "height"]);

expect("height" in stats).toBeTruthy();
expect("avgfee" in stats).toBeTruthy();
expect(stats.height).toBeGreaterThanOrEqual(1);
expect(Object.keys(stats).length).toEqual(2);

const blockHash = await waitForBlockHash(1)
const stats = await client.blockchain.getBlockStats(blockHash, ['avgfee', 'height'])

expect('height' in stats).toBeTruthy()
expect('avgfee' in stats).toBeTruthy()
expect(stats.height).toBeGreaterThanOrEqual(1)
expect(Object.keys(stats).length).toEqual(2)
})
})
describe('getBestBlockHash', () => {
test('should Get hash of best block and return a string', async () => {
const bestBlockHash = await client.blockchain.getBestBlockHash();
expect(bestBlockHash).toBeTruthy();
})

test('should Get hash of best block and return a string', async () => {
const bestBlockHash = await client.blockchain.getBestBlockHash()
expect(bestBlockHash).toBeTruthy()
})
})

})
1 change: 0 additions & 1 deletion packages/jellyfish-api-core/src/category/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ export interface MempoolTx {
'bip125-replaceable': boolean
}
}

export interface BlockStats {
avgfee: number
avgfeerate: number
Expand Down

0 comments on commit 49e2a3f

Please sign in to comment.