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

#2107 - E2E test for offering bulk upload #2119

Merged
merged 8 commits into from
Jul 20, 2023
Merged

#2107 - E2E test for offering bulk upload #2119

merged 8 commits into from
Jul 20, 2023

Conversation

ann-aot
Copy link
Contributor

@ann-aot ann-aot commented Jul 19, 2023

  • Created 2 TCs for the bulk insert.
    image
  • I have created a function to clear test db data which is created as part of the TCs because, when a new location or program is created that matches with the CSV for each TC, Due to the unique constraints in DB, we need to clear it.
  • Updated createFakeEducationProgram and createFakeInstitutionLocation

@ann-aot ann-aot self-assigned this Jul 19, 2023
// Arrange
// Creating an institution location with same location code as that of the
// first row of the multiple CSV file.
const collegeFLocationYESK = createFakeInstitutionLocation(
Copy link
Collaborator

Choose a reason for hiding this comment

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

The API test suits run in parallel, hence there is no guarantee that the location with institution code YESK (in this case) could not be created before.

I had the same situation while creating e2e tests for ece response integration. I followed this approach and it worked.
image

We could possibility centralize and re-use the same method. Let me know if I am missing something.


// Act/Assert
await request(app.getHttpServer())
.post(`${endpoint}?validation-only=true`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍


it("Should return program related validation error when bulk offering CSV file with a non existing program SABC code is uploaded. ", async () => {
// Arrange
const randomSABCCode = `XXXX1`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Template literals not required.

* - `user` related user.
* @param options dependencies.
* - `initialValues` initial values.
* @returns
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment for returns.

@dheepak-aot
Copy link
Collaborator

Great Job. Thanks for doing the refactor of createFakeInstitutionLocation. Other than the discussion we had on cleanTestData, just 2 minor comments.

@@ -32,9 +46,9 @@ export function createFakeEducationProgram(
program.hasTravel = "yes";
program.hasIntlExchange = "yes";
program.programDeclaration = true;
program.institution = institution ?? createFakeInstitution();
program.institution = relations?.institution ?? createFakeInstitution();
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

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

* @returns institution location
*/
export function createFakeInstitutionLocation(
institution?: Institution,
relations?: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

export function createFakeEducationProgram(
institution?: Institution,
user?: User,
relations?: {
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

@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.

LGTM 👍

"bulk-insert/multiple-upload.csv",
);

let [responseOfferingSBC1, responseOfferingSBC2] = [undefined, undefined];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggesttion: variables are implicitly undefined when not initialized.
We can use like this.

let responseOfferingSBC1: EducationProgramOffering,
        responseOfferingSBC2: EducationProgramOffering;

offeringStatus: true,
},
where: {
id: In([responseOfferingSBC1.id, responseOfferingSBC2.id]),
Copy link
Collaborator

@dheepak-aot dheepak-aot Jul 20, 2023

Choose a reason for hiding this comment

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

Shouldn't we need to use the order by id to guarantee the result order?

@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.84% ( 2130 / 11938 )
Methods: 8.29% ( 126 / 1520 )
Lines: 20.63% ( 1866 / 9046 )
Branches: 10.06% ( 138 / 1372 )

@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: 71% ( 399 / 562 )
Methods: 61.97% ( 44 / 71 )
Lines: 72.97% ( 351 / 481 )
Branches: 40% ( 4 / 10 )

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 👍

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 52.23% ( 3716 / 7115 )
Methods: 48.59% ( 448 / 922 )
Lines: 57.36% ( 3045 / 5309 )
Branches: 25.23% ( 223 / 884 )

@ann-aot ann-aot merged commit d6f64f5 into main Jul 20, 2023
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:24 — with GitHub Actions Inactive
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:27 — with GitHub Actions Inactive
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:27 — with GitHub Actions Inactive
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:27 — with GitHub Actions Inactive
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:27 — with GitHub Actions Inactive
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:28 — with GitHub Actions Inactive
@ann-aot ann-aot temporarily deployed to DEV July 20, 2023 22:28 — with GitHub Actions Inactive
@ann-aot ann-aot deleted the e2e/sims-#2107 branch July 26, 2023 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants