@@ -26,37 +26,29 @@ describe('API', () => {
26
26
spyOn ( window , 'fetch' )
27
27
} )
28
28
29
- it ( 'should make three requests, one for each stat ' , ( ) => {
29
+ it ( 'should make one request ' , ( ) => {
30
30
API . incrementBtcEthUsageStats ( 0 , 0 )
31
- expect ( window . fetch ) . toHaveBeenCalledTimes ( 3 )
31
+ expect ( window . fetch ) . toHaveBeenCalledTimes ( 1 )
32
32
} )
33
33
34
34
it ( 'should record correctly for btc=0, eth=0' , ( ) => {
35
35
API . incrementBtcEthUsageStats ( 0 , 0 )
36
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_0' ) )
37
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'eth_0' ) )
38
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btceth_0' ) )
36
+ expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_0_eth_0' ) )
39
37
} )
40
38
41
39
it ( 'should record correctly for btc>0, eth=0' , ( ) => {
42
40
API . incrementBtcEthUsageStats ( 1 , 0 )
43
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_1' ) )
44
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'eth_0' ) )
45
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btceth_0' ) )
41
+ expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_1_eth_0' ) )
46
42
} )
47
43
48
44
it ( 'should record correctly for btc=0, eth>0' , ( ) => {
49
45
API . incrementBtcEthUsageStats ( 0 , 1 )
50
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_0' ) )
51
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'eth_1' ) )
52
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btceth_0' ) )
46
+ expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_0_eth_1' ) )
53
47
} )
54
48
55
49
it ( 'should record correctly for btc>0, eth>0' , ( ) => {
56
50
API . incrementBtcEthUsageStats ( 1 , 1 )
57
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_1' ) )
58
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'eth_1' ) )
59
- expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btceth_1' ) )
51
+ expect ( window . fetch ) . toHaveBeenCalledWith ( eventUrl ( 'btc_1_eth_1' ) )
60
52
} )
61
53
} )
62
54
} ) ;