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

#1929 - Current days of study/studybreaks count is 1 short of total #1975

Merged
merged 5 commits into from
May 30, 2023

Conversation

andrepestana-aot
Copy link
Collaborator

@andrepestana-aot andrepestana-aot commented May 29, 2023

  • Added 1 day to the calculation of dateDifference as all date periods will be calculated with start and end dates inclusive;
  • Changed education program offering form to add 1 day in the calculated value for study break days;
  • Added unit tests to check the calculation results for 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.

@andrepestana-aot andrepestana-aot self-assigned this May 29, 2023
@andrepestana-aot andrepestana-aot added Bug Something isn't working Institution Institution Features labels May 29, 2023
@andrepestana-aot andrepestana-aot marked this pull request as ready for review May 30, 2023 17:49
);

// Assert
expect(calculatedStudyBreaksAndWeeks).toEqual({
Copy link
Collaborator

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?

Copy link
Collaborator Author

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!

Copy link
Collaborator

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 ❤️

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a 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 👍

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 17.95% ( 2091 / 11648 )
Methods: 8.23% ( 123 / 1494 )
Lines: 20.73% ( 1832 / 8837 )
Branches: 10.33% ( 136 / 1317 )

@github-actions
Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 49.81% ( 267 / 536 )
Methods: 41.56% ( 32 / 77 )
Lines: 55.33% ( 218 / 394 )
Branches: 26.15% ( 17 / 65 )

@github-actions
Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 69.4% ( 390 / 562 )
Methods: 59.15% ( 42 / 71 )
Lines: 71.52% ( 344 / 481 )
Branches: 40% ( 4 / 10 )

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 43.42% ( 3022 / 6960 )
Methods: 37.65% ( 340 / 903 )
Lines: 48.52% ( 2521 / 5196 )
Branches: 18.7% ( 161 / 861 )

Copy link
Collaborator

@guru-aot guru-aot left a 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 👍

Copy link
Collaborator

@sh16011993 sh16011993 left a 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 👍

@andrepestana-aot andrepestana-aot merged commit 614a705 into main May 30, 2023
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 20:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot deleted the 1929_bug_study_study_break_days_count branch May 30, 2023 20:53
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 20:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 20:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 20:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:37 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:37 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:37 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:37 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:53 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:58 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:59 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:59 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:59 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:59 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 22:59 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:33 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:34 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:34 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:34 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 30, 2023 23:34 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Institution Institution Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants