1
+ import test from 'ava'
2
+ import { ClientAccountTxlistinternalTxhash } from '../../src/client/ClientTxlistinternalTxhash'
3
+ import { Address } from '../../src/entities/Address'
4
+ import { ApiKey } from '../../src/entities/Apikey'
5
+ import { decode } from 'querystring'
6
+ const nock = require ( 'nock' )
7
+ import { parse } from 'url'
8
+ import { readFile } from 'fs'
9
+ import { promisify } from 'util'
10
+ const _readFile = promisify ( readFile )
11
+
12
+
13
+ const expectedUrl = 'https://api.etherscan.io/api?module=account&action=txlistinternal&txhash=0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170&apikey=YourApiKeyToken'
14
+ const startblock = '0'
15
+ const endblock = '2702578'
16
+ const txhash = '0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170'
17
+ const apiKey = 'TRU5Z5MNWIEYP4F6DPH2T53IJWZIZ5GT1W'
18
+
19
+ test ( 'exists' , t => {
20
+ t . truthy ( ClientAccountTxlistinternalTxhash )
21
+ } )
22
+
23
+ test ( 'can be instantiated' , t => {
24
+ const oApiKey = new ApiKey ( apiKey )
25
+ new ClientAccountTxlistinternalTxhash ( oApiKey , 'account' , 'txlistinternal' , txhash , startblock , endblock )
26
+ t . pass ( )
27
+ } )
28
+
29
+
30
+ test ( 'generates the right url' , t => {
31
+
32
+ const oApiKey = new ApiKey ( apiKey )
33
+ const c = new ClientAccountTxlistinternalTxhash ( oApiKey , 'account' , 'txlistinternal' , txhash , startblock , endblock )
34
+ const url = c . toUrl ( )
35
+
36
+ const parsedUrl = decode ( url )
37
+ const parsedExpectedUrl = decode ( expectedUrl )
38
+
39
+ t . is ( parsedUrl . txhash , parsedExpectedUrl . txhash )
40
+ } )
41
+
42
+ /*
43
+
44
+
45
+ */
0 commit comments