Skip to content

Commit f3e91a1

Browse files
committed
Refactor Transfers test
1 parent 493b7b7 commit f3e91a1

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

src/__tests__/transfers.spec.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ let client: Client;
99
let transfersAPI: TransfersAPI;
1010
let scope: nock.Scope;
1111

12+
1213
beforeEach((): void => {
1314
if (!nock.isActive()) {
1415
nock.activate();
@@ -55,14 +56,34 @@ describe("Transfers", (): void => {
5556
});
5657

5758
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+
6181
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");
6484
} else {
6585
fail();
6686
}
6787
});
88+
6889
});

0 commit comments

Comments
 (0)