Skip to content

Commit d0815c9

Browse files
committed
Refactor Transfers test
1 parent dab82ee commit d0815c9

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/__tests__/transfers.spec.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,31 @@ describe("Transfers", (): void => {
5555
});
5656

5757
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"));
58+
const createdSince = new Date(Date.UTC(2023, 11, 12, 0, 0, 0)); // 12-12-2023 December is month 11
59+
const createdUntil = new Date(Date.UTC(2023, 11, 13, 0, 0, 0)); // 13-12-2023 December is month 11
60+
61+
scope
62+
.get("/transactions")
63+
.query({
64+
balancePlatform: "platform",
65+
createdSince: createdSince.toISOString(),
66+
createdUntil: createdUntil.toISOString(),
67+
})
68+
.reply(200, listTransactionsSuccess);
69+
70+
const response: transfers.TransactionSearchResponse = await transfersAPI.TransactionsApi.getAllTransactions(
71+
"platform",
72+
undefined,
73+
undefined,
74+
undefined,
75+
undefined,
76+
createdSince,
77+
createdUntil
78+
);
79+
6180
expect(response.data?.length).toEqual(3);
62-
if(response.data && response.data?.length > 0) {
63-
expect(response?.data[0]?.id).toEqual("1VVF0D5U66PIUIVP");
81+
if (response.data && response.data.length > 0) {
82+
expect(response.data[0].id).toEqual("1VVF0D5U66PIUIVP");
6483
} else {
6584
fail();
6685
}

0 commit comments

Comments
 (0)