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

#1683 - Completed application - E2E tests for application tracker #1832

Merged
merged 11 commits into from
Mar 27, 2023

Conversation

andrewsignori-aot
Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot commented Mar 23, 2023

  • Fix for PIR decline throwing an error while completing the process.
  • Refactor application progress details to get rid of the Sonarcloud issue.
  • Icon spacing adjusted (@hellolynn-tbtb is aware of and approved it).
  • Renamed factory method saveFakeApplicationCOE to saveFakeApplicationDisbursements allowing it to be used for these E2E tests also.
  • Removed prefix ${ClientTypeBaseRoute.Institution} from some E2E that were wrongly added.
  • E2E tests for the new endpoint added for the completed status.
    ApplicationStudentsController(e2e)-getCompletedApplicationDetails
    ✓ Should throw NotFoundException when the application is not associated with the authenticated student. (390 ms)
    ✓ Should throw NotFoundException when the application is not in 'Completed' status. (75 ms)
    ✓ Should get application details when application is in 'Completed' status. (76 ms)
    ✓ Should get application details with scholastic standing change type when application has a scholastic standing 'Student did not complete program associated with. (60 ms)
    ✓ Should get application details with the most updated appeal status when the application has more than one student appeals associated with. (78 ms)

image

image

image

fakeOriginalAssessment,
);
savedApplication.currentAssessment = savedOriginalAssessment;
savedApplication.applicationStatus = ApplicationStatus.Enrolment;
Copy link
Contributor

Choose a reason for hiding this comment

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

mm, we are already saving the status at line 95 right? then why this assignment

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 do not see a reason to. I will remove the last one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.


it("Should get application details when application is in 'Completed' status.", async () => {
// Arrange
const application = await saveFakeApplicationDisbursements(
Copy link
Contributor

@ann-aot ann-aot Mar 24, 2023

Choose a reason for hiding this comment

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

mm, instead of getting a fake disbursement application and changing the data in the test to make it completed, can't we create a fakecompletedAppliaction? is there any reason for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When we need an application with disbursements we will need: createFakeApplication, createFakeStudentAssessment, createFakeDisbursementSchedule, createFakeEducationProgramOffering, createFakeUser, createFakeStudent, etc., and then have all of them saved properly. When this method was introduced in the past for COE (and now renamed/moved for disbursements), the idea was to concentrate all the complexity of calling the previously mentioned createFake methods and coordinate the way that they must be saved.
Does it answer? If not maybe I am not getting the point and we can have a chat. Please let me know.

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 guess that the answer is the same from #1832 (comment)

const scholasticStanding = createFakeStudentScholasticStanding({
submittedBy: submittedByInstitutionUser,
});
// 'Student did not complete program' is the only'scholastic standing that does not generate an assessment.
Copy link
Contributor

Choose a reason for hiding this comment

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

only scholastic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

firstDisbursement.coeStatus = COEStatus.completed;
await disbursementScheduleRepo.save(firstDisbursement);
// Create a scholastic standing and have it associated with the completed application.
const scholasticStanding = createFakeStudentScholasticStanding({
Copy link
Contributor

Choose a reason for hiding this comment

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

application can be passed here itself right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.

application.currentAssessment.disbursementSchedules;
firstDisbursement.coeStatus = COEStatus.completed;
await disbursementScheduleRepo.save(firstDisbursement);
// Create approved student appeal
Copy link
Contributor

Choose a reason for hiding this comment

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

full stop

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 will add the period.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Period added.

appealRequests: [approvedAppealRequest],
});
approvedAppeal.submittedDate = addDays(-1);
// Create declined student appeal from yesterday
Copy link
Contributor

Choose a reason for hiding this comment

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

full stop

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 will add the period.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Period added.

@@ -31,7 +31,7 @@ export default defineComponent({
required: true,
},
cancelledDate: {
type: String,
type: Date,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

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.

Good work @andrewsignori-aot . added some comments

@@ -1504,10 +1500,6 @@ export class ApplicationService extends RecordDataModelService<Application> {
student: {
id: options?.studentId,
},
studentScholasticStandings: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

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.

* - `submittedBy` institution user submitting the scholastic standing change.
* - `application` related student application.
* - `studentAssessment` related assessment.
* - `student` related student.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove student comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

endStatusType?: "success" | "warning" | "error";
endStatusIcon?: string;
class StatusIconDetails {
constructor(public statusType?: "success" | "warning" | "error") {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that having the statusType as optional is replicating the pattern of the interface, but I somehow feel like statusType doesn't need to be optional as it would never be expected to be initialized without passing statusType.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This code was refactored, please take a look at the lastest PR updates.

endStatusType: "error",
endStatusIcon: "fa:fas fa-exclamation-circle",
};
statusIconDetails.value = new StatusIconDetails("success");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this way of getting status icon details by associating the dependency between variables. We could start following this patten in such scenarios IMO. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I thought the same, but after our last Team conversation I thought that it would potentially cause more questions than benefits and that is why I did a refactor here. Please let me know if it is still ok.

@github-actions
Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 18.01% ( 1949 / 10824 )
Methods: 8.19% ( 115 / 1404 )
Lines: 20.69% ( 1705 / 8240 )
Branches: 10.93% ( 129 / 1180 )

@github-actions
Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 31.39% ( 167 / 532 )
Methods: 20.51% ( 16 / 78 )
Lines: 38.3% ( 149 / 389 )
Branches: 3.08% ( 2 / 65 )

@github-actions
Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 56.72% ( 308 / 543 )
Methods: 46.38% ( 32 / 69 )
Lines: 59.48% ( 276 / 464 )
Branches: 0% ( 0 / 10 )

endStatusType: "error",
endStatusIcon: "fa:fas fa-exclamation-circle",
};
statusIconDetails.value = STATUS_ICON_SUCCESS;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use the same class concept here and avoid using 3 interfaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the refactoring of the previous class. There is only one interface, I am not following what would be "avoid using 3 interfaces.".

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 36.81% ( 2466 / 6699 )
Methods: 28.39% ( 247 / 870 )
Lines: 42.39% ( 2118 / 4997 )
Branches: 12.14% ( 101 / 832 )

@dheepak-aot
Copy link
Collaborator

Good work @andrewsignori-aot . Thanks for additional refactors. Just one minor comment.

@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.2% 0.2% Duplication

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.

LGTM. 👍

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.

Good work @andrewsignori-aot 👍 Thanks for doing the changes

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 @andrewsignori-aot

@andrewsignori-aot andrewsignori-aot merged commit 70f04fd into main Mar 27, 2023
@andrewsignori-aot andrewsignori-aot temporarily deployed to DEV March 27, 2023 19:51 — with GitHub Actions Inactive
@andrewsignori-aot andrewsignori-aot deleted the feature/#1683-application-tracker-e2e-tests branch March 27, 2023 19:51
@andrewsignori-aot andrewsignori-aot temporarily deployed to DEV March 27, 2023 19:51 — with GitHub Actions Inactive
@andrewsignori-aot andrewsignori-aot temporarily deployed to DEV March 27, 2023 20:10 — with GitHub Actions Inactive
guru-aot pushed a commit that referenced this pull request Mar 28, 2023
)

- Fix for PIR decline throwing an error while completing the process.
- Refactor application progress details to get rid of the Sonarcloud issue.
- Icon spacing adjusted (@hellolynn-tbtb is aware of and approved it).
- Renamed factory method saveFakeApplicationCOE to saveFakeApplicationDisbursements allowing it to be used for these E2E tests also.
- Removed prefix ${ClientTypeBaseRoute.Institution} from some E2E that were wrongly added.
- E2E tests for the new endpoint added for the completed status.
ApplicationStudentsController(e2e)-getCompletedApplicationDetails
✓ Should throw NotFoundException when the application is not associated with the authenticated student. (390 ms)
✓ Should throw NotFoundException when the application is not in 'Completed' status. (75 ms)
✓ Should get application details when application is in 'Completed' status. (76 ms)
✓ Should get application details with scholastic standing change type when application has a scholastic standing 'Student did not complete program associated with. (60 ms)
✓ Should get application details with the most updated appeal status when the application has more than one student appeals associated with. (78 ms)
guru-aot pushed a commit that referenced this pull request Mar 28, 2023
)

- Fix for PIR decline throwing an error while completing the process.
- Refactor application progress details to get rid of the Sonarcloud issue.
- Icon spacing adjusted (@hellolynn-tbtb is aware of and approved it).
- Renamed factory method saveFakeApplicationCOE to saveFakeApplicationDisbursements allowing it to be used for these E2E tests also.
- Removed prefix ${ClientTypeBaseRoute.Institution} from some E2E that were wrongly added.
- E2E tests for the new endpoint added for the completed status.
ApplicationStudentsController(e2e)-getCompletedApplicationDetails
✓ Should throw NotFoundException when the application is not associated with the authenticated student. (390 ms)
✓ Should throw NotFoundException when the application is not in 'Completed' status. (75 ms)
✓ Should get application details when application is in 'Completed' status. (76 ms)
✓ Should get application details with scholastic standing change type when application has a scholastic standing 'Student did not complete program associated with. (60 ms)
✓ Should get application details with the most updated appeal status when the application has more than one student appeals associated with. (78 ms)
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.

5 participants