@@ -9,6 +9,7 @@ let client: Client;
9
9
let transfersAPI : TransfersAPI ;
10
10
let scope : nock . Scope ;
11
11
12
+
12
13
beforeEach ( ( ) : void => {
13
14
if ( ! nock . isActive ( ) ) {
14
15
nock . activate ( ) ;
@@ -55,14 +56,34 @@ describe("Transfers", (): void => {
55
56
} ) ;
56
57
57
58
test ( "should list transactions" , async ( ) : Promise < void > => {
58
- scope . get ( "/transactions?balancePlatform=platform&createdSince=2023-12-12T00%3A00%3A00.000Z&createdUntil=2023-12-13T00%3A00%3A00.000Z" )
59
- . reply ( 200 , listTransactionsSuccess ) ;
60
- const response : transfers . TransactionSearchResponse = await transfersAPI . TransactionsApi . getAllTransactions ( "platform" , undefined , undefined , undefined , undefined , new Date ( "12-12-2023" ) , new Date ( "12-13-2023" ) ) ;
59
+ const createdSince = new Date ( Date . UTC ( 2023 , 11 , 12 , 0 , 0 , 0 ) ) ; // 12-12-2023 December is month 11
60
+ const createdUntil = new Date ( Date . UTC ( 2023 , 11 , 13 , 0 , 0 , 0 ) ) ; // 13-12-2023 December is month 11
61
+
62
+ scope
63
+ . get ( "/transactions" )
64
+ . query ( {
65
+ balancePlatform : "platform" ,
66
+ createdSince : createdSince . toISOString ( ) ,
67
+ createdUntil : createdUntil . toISOString ( ) ,
68
+ } )
69
+ . reply ( 200 , listTransactionsSuccess ) ;
70
+
71
+ const response : transfers . TransactionSearchResponse = await transfersAPI . TransactionsApi . getAllTransactions (
72
+ "platform" ,
73
+ undefined ,
74
+ undefined ,
75
+ undefined ,
76
+ undefined ,
77
+ createdSince ,
78
+ createdUntil
79
+ ) ;
80
+
61
81
expect ( response . data ?. length ) . toEqual ( 3 ) ;
62
- if ( response . data && response . data ? .length > 0 ) {
63
- expect ( response ? .data [ 0 ] ? .id ) . toEqual ( "1VVF0D5U66PIUIVP" ) ;
82
+ if ( response . data && response . data . length > 0 ) {
83
+ expect ( response . data [ 0 ] . id ) . toEqual ( "1VVF0D5U66PIUIVP" ) ;
64
84
} else {
65
85
fail ( ) ;
66
86
}
67
87
} ) ;
88
+
68
89
} ) ;
0 commit comments