1
- var test = require ( 'tape' )
1
+ 'use strict'
2
+ const test = require ( 'tape' )
2
3
3
4
// set to global
4
5
global . fetch = require ( 'node-fetch' )
5
- var cc = require ( '../' )
6
+ const cc = require ( '../' )
6
7
7
- test ( 'coinList()' , function ( t ) {
8
+ test ( 'coinList()' , t => {
8
9
t . plan ( 1 )
9
10
cc . coinList ( ) . then ( coinList => {
10
11
t . strictEqual ( coinList . BTC . CoinName , 'Bitcoin' , 'CoinName field should be Bitcoin' )
11
12
} ) . catch ( t . end )
12
13
} )
13
14
14
- test ( 'price()' , function ( t ) {
15
+ test ( 'price()' , t => {
15
16
t . plan ( 4 )
16
17
cc . price ( 'BTC' , [ 'USD' , 'CNY' ] ) . then ( prices => {
17
18
t . strictEqual ( prices [ 0 ] . Symbol , 'USD' , 'prices[0].Symbol === USD' )
@@ -22,10 +23,10 @@ test('price()', function (t) {
22
23
} ) . catch ( t . end )
23
24
} )
24
25
25
- test ( 'priceHistorical()' , function ( t ) {
26
+ test ( 'priceHistorical()' , t => {
26
27
t . plan ( 5 )
27
28
// Arbitrary timestamp; historical values are hard-coded into this test
28
- var timestamp = new Date ( 1456149600 * 1000 )
29
+ const timestamp = new Date ( 1456149600 * 1000 )
29
30
cc . priceHistorical ( 'BTC' , [ 'USD' , 'CNY' ] , timestamp ) . then ( prices => {
30
31
t . strictEqual ( prices [ 0 ] . Symbol , 'USD' , 'prices[0].Symbol === USD' )
31
32
t . strictEqual ( typeof prices [ 0 ] . Price , 'number' , 'prices[0].Price is a number' )
0 commit comments