Skip to content

Commit 09783aa

Browse files
committed
fix(cypress): update date-fns usage in actualisation warning tests to correctly calculate activity date thresholds
1 parent b9fdca0 commit 09783aa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/reva-candidate/cypress/e2e/actualisation-warning.cy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addDays, subDays, subMonths, subWeeks } from "date-fns";
1+
import { addDays, addWeeks, subDays, subMonths } from "date-fns";
22
import { stubMutation, stubQuery } from "../utils/graphql";
33

44
context("Actualisation Warning", () => {
@@ -118,23 +118,23 @@ context("Actualisation Warning", () => {
118118
name: "activity date is before threshold (5 months, 1 week and 6 days)",
119119
lastActivityDate: () => {
120120
const date = new Date();
121-
return addDays(subWeeks(subMonths(date, 6), 2), 1).getTime();
121+
return addDays(addWeeks(subMonths(date, 6), 2), 1).getTime();
122122
},
123123
shouldShowWarning: false,
124124
},
125125
{
126126
name: "activity date is exactly at threshold (5 months, 2 weeks)",
127127
lastActivityDate: () => {
128128
const date = new Date();
129-
return subWeeks(subMonths(date, 6), 2).getTime();
129+
return addWeeks(subMonths(date, 6), 2).getTime();
130130
},
131131
shouldShowWarning: true,
132132
},
133133
{
134-
name: "activity date is after threshold (5 months, 2 weeks - 1 day)",
134+
name: "activity date is after threshold (5 months, 2 weeks and 1 day)",
135135
lastActivityDate: () => {
136136
const date = new Date();
137-
return subDays(subWeeks(subMonths(date, 6), 2), 1).getTime();
137+
return subDays(addWeeks(subMonths(date, 6), 2), 1).getTime();
138138
},
139139
shouldShowWarning: true,
140140
},

0 commit comments

Comments
 (0)