Skip to content

Commit 42852d1

Browse files
committed
pr test fixes
1 parent 5a58398 commit 42852d1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

__mocks__/forms/rfe-forms/component-art.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
{
4545
"type": "js_expression",
46-
"failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')",
46+
"failsWhenExpression": "dayjs(encDate).isBefore(dayjs(myValue), 'day') || dayjs(encDate).isSame(dayjs(myValue), 'day')",
4747
"message": "Date should be before the encounter date."
4848
}
4949
]
@@ -114,7 +114,7 @@
114114
},
115115
{
116116
"type": "js_expression",
117-
"failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')",
117+
"failsWhenExpression": "dayjs(encDate).isBefore(dayjs(myValue), 'day') || dayjs(encDate).isSame(dayjs(myValue), 'day')",
118118
"message": "ARV start date should be before the encounter date."
119119
}
120120
]
@@ -134,7 +134,7 @@
134134
},
135135
{
136136
"type": "js_expression",
137-
"failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')",
137+
"failsWhenExpression": "dayjs(encDate).isBefore(dayjs(myValue), 'day') || dayjs(encDate).isSame(dayjs(myValue), 'day')",
138138
"message": "ARV start date should be before the encounter date."
139139
}
140140
]
@@ -154,7 +154,7 @@
154154
},
155155
{
156156
"type": "js_expression",
157-
"failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')",
157+
"failsWhenExpression": "dayjs(encDate).isBefore(dayjs(myValue), 'day') || dayjs(encDate).isSame(dayjs(myValue), 'day')",
158158
"message": "ARV start date should be before the encounter date."
159159
}
160160
]

src/hooks/useInitialValues.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('useInitialValues', () => {
6767

6868
const { result } = renderHook(() => useInitialValues(formProcessor, false, context));
6969

70-
await waitFor(() => expect(result.current.isLoadingInitialValues).toBe(true));
70+
await waitFor(() => expect(result.current.isLoadingInitialValues).toBe(false));
7171

7272
expect(formProcessor.getInitialValues).toHaveBeenCalledWith(context);
7373
expect(result.current.initialValues).toEqual(mockInitialValues);

src/utils/expression-runner.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ describe('Expression runner', () => {
387387
// setup - use a known date 30 days ago
388388
const thirtyDaysAgo = new Date();
389389
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
390-
const dateOfBirthString = thirtyDaysAgo.toISOString().split('T')[0];
390+
const dateOfBirthString = thirtyDaysAgo.toLocaleDateString('en-CA'); // en-CA produces YYYY-MM-DD in local time
391391
valuesMap['dateOfBirth'] = dateOfBirthString;
392392

393393
// Calculate days difference

0 commit comments

Comments
 (0)