Skip to content
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

❌🙁 Fix codecov-test failure - ‼️📅 Rewrite - notifScheduler.ts #1123

Merged

Conversation

sebastianbarry
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (6e3af4f) 58.83% compared to head (aa68cb0) 68.14%.
Report is 58 commits behind head on service_rewrite_2023.

Additional details and impacted files
@@                   Coverage Diff                    @@
##           service_rewrite_2023    #1123      +/-   ##
========================================================
+ Coverage                 58.83%   68.14%   +9.31%     
========================================================
  Files                        26       27       +1     
  Lines                      1421     1557     +136     
  Branches                    320      332      +12     
========================================================
+ Hits                        836     1061     +225     
+ Misses                      585      496      -89     
Flag Coverage Δ
unit 68.14% <96.68%> (+9.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
www/js/services/commHelper.ts 25.00% <100.00%> (+1.27%) ⬆️
www/js/splash/notifScheduler.ts 100.00% <100.00%> (ø)
www/js/config/dynamicConfig.ts 84.67% <86.66%> (+66.35%) ⬆️

... and 1 file with indirect coverage changes

@sebastianbarry
Copy link
Contributor Author

Why was it failing?

The test was working correctly, but the problem was that the logDebug statement was not being ran.

What did I do to fix it?

I corrected this by making the expect statement actually expect the output rather than the logDebug statement arguments.
However, when I did this I encountered a second error. I created an expectedScheduledNotifs function that is an array containing objects with keys { key: "November 19, 2023" val: "9:00 PM" }. This is what the expected values look like, but the resulted values contain a strange unicode character U+202F in "9:00 PM"which fails the equivalence test. I am not sure how to go about testing these values, since my local computer fails the test if I try to expect these values. My solution was to only expect the key value for them. This is only a temporary soluiton, so I am open to suggestions, but it will pass the codecov test for now.

Do I need to do anything to squash merge my PR with this PR?

@sebastianbarry
Copy link
Contributor Author

@shankari added to Ready for Review

Copy link
Contributor

@shankari shankari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to merge this to unblock @the-bay-kay but I have several questions about this.

The test was working correctly, but the problem was that the logDebug statement was not being ran.

  1. Why was the logDebug statement not being run?
    • Note also my cleanup comment for the original PR was that we shouldn't rely on logDebug to verify values but should add in introspection methods and check the values correctly. Please make sure to implement all those "future" changes.
  2. U+202F is a non-breaking space https://www.compart.com/en/unicode/U+202F It has nothing to do with the quotes. I'm guessing you copy-pasted something from a website, and introduced the NNBSP into the text by default. You will need to delete and type this out to remove it, or view the text in non-unicode to see the character that you remove.

Finally, I am very skeptical that you were not able to reproduce the error(s) while running locally after pulling from the service_rewrite_2023 branch, since multiple other PRs that were based on the branch had failing tests.

I would encourage you to re-pull after this and try to clean up the tests, both in this PR and in the original one.

Comment on lines +82 to +83
console.log('test log: isScheduling during getScheduledNotifs', isScheduling);
console.log('test log: scheduledPromise during getScheduledNotifs', scheduledPromise);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need these console.log statements?

Comment on lines -270 to +281
expect(setIsScheduling).toHaveBeenCalledWith(true);
expect(logDebug).toHaveBeenCalledWith('After cancelling, there are no scheduled notifications');
expect(logDebug).toHaveBeenCalledWith(
'After scheduling, there are 4 scheduled notifications at 21:00 first is November 19, 2023 at 9:00 PM',
);
expect(setIsScheduling).toHaveBeenCalledWith(false);
expect(scheduledNotifs).toHaveLength(4);
expect(scheduledNotifs[0].key).toEqual(expectedResultcheduleNotifs[0].key);
expect(scheduledNotifs[1].key).toEqual(expectedResultcheduleNotifs[1].key);
expect(scheduledNotifs[2].key).toEqual(expectedResultcheduleNotifs[2].key);
expect(scheduledNotifs[3].key).toEqual(expectedResultcheduleNotifs[3].key);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the setIsScheduling checks. Why are they no longer required?

@shankari
Copy link
Contributor

Squash merging to avoid commit churn
@the-bay-kay please pull and then resolve conflicts and address my comments so I can merge your PR as well.

@shankari shankari merged commit 3cbb5f0 into e-mission:service_rewrite_2023 Jan 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants