-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(test):Adding some test coverage for form-helper functions #332
Conversation
it('should parse valid date string with time correctly', () => { | ||
const dateString = '2023-06-27T14:30:00'; | ||
const expectedDate = new Date(2023, 5, 27, 14, 30, 0); | ||
const parsedDate = parseToLocalDateTime(dateString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samuelmale why aren't we using parseDate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No good reason! I agree we should rely more on the utils exposed by the framework.
src/utils/form-helper.test.ts
Outdated
|
||
test('works with different patient data', () => { | ||
patient = { id: 'patient2', name: 'Jane Doe' }; | ||
mockExpressionRunnerFn.mockReturnValue(false); | ||
const result = evaluateDisabled(node, allFields, allValues, sessionMode, patient, mockExpressionRunnerFn); | ||
expect(result).toBe(false); | ||
expect(mockExpressionRunnerFn).toHaveBeenCalledWith( | ||
node.value.disabled.disableWhenExpression, | ||
node, | ||
allFields, | ||
allValues, | ||
{ mode: sessionMode, patient }, | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot imagine what could cause this test to fail. Why is this a useful test?
test('works with different patient data', () => { | |
patient = { id: 'patient2', name: 'Jane Doe' }; | |
mockExpressionRunnerFn.mockReturnValue(false); | |
const result = evaluateDisabled(node, allFields, allValues, sessionMode, patient, mockExpressionRunnerFn); | |
expect(result).toBe(false); | |
expect(mockExpressionRunnerFn).toHaveBeenCalledWith( | |
node.value.disabled.disableWhenExpression, | |
node, | |
allFields, | |
allValues, | |
{ mode: sessionMode, patient }, | |
); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one question @gitcliff , otherwise LGTM. Please answer the question (or delete the test) and then we'll merge this in.
I'm not well-positioned to evaluate whether these are actually useful tests, or whether it is too much "testing implementation details." I will leave that evaluation to @samuelmale and @pirupius .
* (test):Adding some test coverage for form-helper functions * Update src/utils/form-helper.test.ts * deletes unecessary test --------- Co-authored-by: Brandon Istenes <brandonesbox@gmail.com> Co-authored-by: Pius Rubangakene <piruville@gmail.com>
Requirements
Summary
PR is adding test coverage for some form helper functions
Screenshots
Related Issue
Other