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

#1978 - Request an Offering Change: Student View Request - e2e tests (Part 2) #2240

Merged

Conversation

sh16011993
Copy link
Collaborator

@sh16011993 sh16011993 commented Aug 31, 2023

As a part of this PR, the following task was completed

  • The below test cases were written for the controller ApplicationOfferingChangeRequestStudentsController and controller EducationProgramOfferingStudentsController endpoints:

  • getApplicationOfferingChangeRequest
    √ Should return the application offering change request details when provided with the application offering change request id.
    √ Should throw a HttpStatus Not Found (404) when the application offering change request is not associated with the authenticated student.

  • getApplicationOfferingChangeRequestStatus
    √ Should return the application offering change request status when provided with the application offering change request id.
    √ Should throw a HttpStatus Not Found (404) when the application offering status change request is not associated with the authenticated student.

  • updateApplicationOfferingChangeRequest
    √ Should update the application offering change request status for the provided application offering change request id.
    √ Should throw a HttpStatus Not Found (404) error when an application offering change update is requested for an application not in completed state.
    √ Should throw a HttpStatus Not Found (404) error when an application offering change is not associated with the authenticated student.
    √ Should throw a HttpStatus Not Found (404) error when an application offering change is not in a valid status to be updated.
    √ Should throw a HttpStatus Unprocessable Entity (422) error when an invalid application offering change request is made.
    √ Should throw a HttpStatus Unprocessable Entity (422) error when student consent is not provided.

  • getOfferingSummaryDetails
    √ Should get the offering simplified details, not including the validations, approvals and extensive data when the provided purpose is application-offering-change.
    √ Should throw the Not Found (404) exception when the student is not authorized for the provided offering.
    √ Should throw the Not Found (404) exception when the offering summary purpose is not provided.

Note

Increased memory heap size to 12288 MB to fix the "heap limit allocation failed - JavaScript heap out of memory" error.

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

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

The tests look good. We just need to investigate the memory issue.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes, just one more comment

@dheepak-aot
Copy link
Collaborator

@sh16011993 didn't we include e2e test for the offering controller that we added?

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.

Nice coverage, please take a look at the comments.

@sh16011993
Copy link
Collaborator Author

@sh16011993 didn't we include e2e test for the offering controller that we added?

I missed it @dheepak-aot . Thanks for pointing it out. I will add it.

@@ -115,7 +115,7 @@ export class ApplicationOfferingChangeRequestStudentsController extends BaseCont
description:
"Invalid application offering change status or student consent not provided",
})
async updateApplicationOfferingChangeRequestStatus(
async updateApplicationOfferingChangeRequest(
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

let applicationRepo: Repository<Application>;
let assessmentRepo: Repository<StudentAssessment>;

const deliveryMethod = (offering: EducationProgramOffering) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe that usually, we keep the helper method at the end of the file. If it is something to be reused outside this file it an be moved to a different file/util.

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.

Thanks for doing the changes, just left a minor comment, hence approving it 👍

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.

LGTM, nice work @sh16011993

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

LGTM @sh16011993 . thanks for doing the changes and fixing the memory issue in the PR

await app?.close();
});

const deliveryMethod = (offering: EducationProgramOffering) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can be simplified:
image

Copy link
Collaborator

@andrepestana-aot andrepestana-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 job. Left a minor comment.

Comment on lines 48 to 62
const savedUser = await db.user.save(createFakeUser());
const fakeOffering = createFakeEducationProgramOffering({
auditUser: savedUser,
});
const offering = await db.educationProgramOffering.save(fakeOffering);
const fakeApplication = createFakeApplication({ student });
const application = await applicationRepo.save(fakeApplication);
const fakeAssessment = createFakeStudentAssessment({
auditUser: savedUser,
application,
offering,
});
fakeApplication.currentAssessment = fakeAssessment;
await applicationRepo.save(fakeApplication);
await assessmentRepo.save(fakeAssessment);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could have used the saveFakeApplication with student and it would have replaced all the code here right?

I am not going to call it a blocker but to keep in mind for upcoming e2es.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have made the changes @dheepak-aot . Thanks for pointing it out. 👍


it("Should throw the Not Found (404) exception when the offering summary purpose is not provided.", async () => {
// Arrange
const savedUser = await db.user.save(createFakeUser());
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2023

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

github-actions bot commented Sep 7, 2023

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 17.63% ( 2183 / 12383 )
Methods: 8.05% ( 126 / 1565 )
Lines: 20.46% ( 1919 / 9380 )
Branches: 9.6% ( 138 / 1438 )

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 72.5% ( 406 / 560 )
Methods: 63.38% ( 45 / 71 )
Lines: 74.53% ( 357 / 479 )
Branches: 40% ( 4 / 10 )

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 46.73% ( 300 / 642 )
Methods: 40% ( 32 / 80 )
Lines: 51.02% ( 251 / 492 )
Branches: 24.29% ( 17 / 70 )

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

E2E SIMS API Coverage Report

Totals Coverage
Statements: 54.18% ( 3998 / 7379 )
Methods: 50.84% ( 485 / 954 )
Lines: 59.07% ( 3251 / 5504 )
Branches: 28.45% ( 262 / 921 )

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes 👍

@sh16011993 sh16011993 merged commit 9050fef into main Sep 7, 2023
@sh16011993 sh16011993 deleted the 1978_request_offering_change_student_view_request_e2e_tests branch September 7, 2023 18:26
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:41 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:44 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:44 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:44 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:44 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:47 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV September 7, 2023 18:47 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants