Skip to content

Commit

Permalink
Added test cases to increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavk99 committed May 14, 2018
1 parent 0a57ff8 commit 565838b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test.js
Expand Up @@ -21,6 +21,26 @@ test('should get latest ticker', async () => {
expect(Object.keys(ticker2.data).length).toBe(10)
})

test('should get Bitcoin ticker from currency symbol', async () => {
const client = new CoinMarketCap()
const ticker = await client.getTicker({currency: 'BTC'})

expect(typeof ticker).toBe('object')
expect(ticker.data.id).toBe(1)
expect(ticker.data.name).toMatch('Bitcoin')
expect(ticker.data.symbol).toMatch('BTC')
})

test('should get Bitcoin ticker from its listings ID', async () => {
const client = new CoinMarketCap()
const ticker = await client.getTicker({ id: 1 })

expect(typeof ticker).toBe('object')
expect(ticker.data.id).toBe(1)
expect(ticker.data.name).toMatch('Bitcoin')
expect(ticker.data.symbol).toMatch('BTC')
})

test('should result in errors due to wrong parameter usage', async () => {
const client = new CoinMarketCap()

Expand Down

0 comments on commit 565838b

Please sign in to comment.