Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 442d147

Browse files
committed
fix: tests
1 parent a41e25f commit 442d147

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/__tests__/task.tests.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,23 @@ describe("API Tasks Functions", () => {
125125
(allTodayJSON = await myClient.extras.getTodayTaskJSON()),
126126
(allTodayNames = await myClient.extras.getTodayTaskNames()),
127127
]);
128-
129128
const firstTaskExists =
130129
allTodayJSON.some((taskObj) => taskObj.content === "First task") &&
131130
allTodayNames.some((name) => name === "First task");
132131

133-
expect(allTodayJSON.length).toBe(2);
134-
expect(typeof allTodayJSON[0]).toBe("object");
135-
expect(firstTaskExists).toBe(true);
132+
let normalDate = new Date().toISOString().substring(0, 10);
133+
let momentDate = moment.parseZone(new Date()).format().substring(0, 10);
134+
135+
if (normalDate === momentDate) {
136+
// GMT day = local day
137+
expect(allTodayJSON.length).toBe(2);
138+
expect(typeof allTodayJSON[0]).toBe("object");
139+
expect(firstTaskExists).toBe(true);
140+
} else {
141+
// GMT day != local day (offset influence in day)
142+
expect(allTodayJSON.length).toBe(0);
143+
expect(firstTaskExists).toBe(false);
144+
}
136145
});
137146

138147
test("Test getAllTaskNames", async () => {

0 commit comments

Comments
 (0)