-
Notifications
You must be signed in to change notification settings - Fork 14
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
#1929 - Current days of study/studybreaks count is 1 short of total #1975
Conversation
); | ||
|
||
// Assert | ||
expect(calculatedStudyBreaksAndWeeks).toEqual({ |
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.
Is there a benefit of using toStrictEqual
instead toEqual
for these cases?
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.
In this case we can use .toStrictEqual
because the service is creating an object literal.
Benefits of using .toEqual
:
- keys with undefined properties are checked, e.g. {a: undefined, b: 2} will not equal {b: 2};
- undefined items are taken into account, e.g. [2] will not equal [2, undefined];
- array sparseness is checked, e.g. [, 1] will not equal [undefined, 1];
- object types are checked, e.g. a class instance with fields a and b will not equal a literal object with fields a and b.
I changed the comparions to .toStrictEqual
. Thanks!
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.
Great to see some tests added to this ❤️
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.
Great work and thanks for adding the unit tests. Looks good 👍
Kudos, SonarCloud Quality Gate passed!
|
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.
Nice work @andrepestana-aot , thanks for adding the test cases 👍
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.
Looks good to me 👍
dateDifference
as all date periods will be calculated with start and end dates inclusive;getCalculatedStudyBreaksAndWeeks
method:√ Should calculate funded study period and total days when study start and end study dates are available. (4 ms)
√ Should not calculate funded study period days and total days when study start date is not available.
√ Should not calculate funded study period days and total days when study end date is not available. (1 ms)
√ Should calculate study breaks when start and end study break dates available. (1 ms)
√ Should not calculate study breaks when start study break date is not available.
√ Should not calculate study breaks when end study break date is not available.
√ Should calculate eligible break days as a maximum of 21 days when a study break exceeds it.