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

#1864 - MSFAA Receive File E2E Test Automation #1913

Merged
merged 7 commits into from
May 2, 2023

Conversation

andrewsignori-aot
Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot commented Apr 28, 2023

  • Created the method mockDownloadFiles to allow the simulation of a file downloaded from SFTP.
    The file will be available on the disk and the SSH client methods list and get will be mocked to allow the SSH methods to be invoked as usual but returning the mocked file instead.
  • Small change on the logs with the intention to be more clear to read.
  • Created the methods getStructuredRecords and createFileFromStructuredRecords to allow the file content manipulation before the mocked file content is downloaded.
  • Created three mock files to be used as downloaded mocks files from SFTP. Some files are reused and have their content changed. The idea of this PR is to show both approaches that can be used.
    • First approach: use a new mocked file when convenient,
    • Second approach: reuse an existing mocked file and adapt its content as needed. Ideally used when a small modification is needed. Up to the developer to decide.

E2E tests

√ Should process an MSFAA response with confirmations and a cancellation and update all records when the file is received as expected. (280 ms)
√ Should successfully process 2 MSFAA records when a file has 3 records but one throws an error during DB update. (212 ms)
√ Should throw an error when the MSFAA file contains an invalid SIN hash total. (14 ms)
√ Should throw an error when the MSFAA file contains an invalid record count. (7 ms)
√ Should throw an error when the MSFAA file contains an invalid header code. (9 ms)
√ Should throw an error when the MSFAA file contains an invalid footer code. (9 ms)

{ dateSigned: IsNull() },
{ dateSigned: getISODateOnlyString(new Date()) },
);
// Cancel any pending MSFAA.
Copy link
Contributor

Choose a reason for hiding this comment

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

mm...here what does it mean "pending MSFAA"? when dateSigned === null then MSFAA is pending, 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.

},
});
expect(msfaaUpdatedRecords).toHaveLength(msfaaInputData.length);
const [fistSignedMSFAA, cancelledMSFAA, secondSignedMSFAA] =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: the name of the variable should be "firstSignedMSFAA".

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.

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.

Looks good. Great job!

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 with receive file test👍 just minor comments.

@@ -76,7 +83,7 @@ export class MSFAAResponseProcessingService {
try {
await this.processCancelledRecord(cancelledRecord);
result.processSummary.push(
`Status cancelled record from line ${cancelledRecord.lineNumber}.`,
`Record from line ${cancelledRecord.lineNumber}, updated as canceled.`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

cancelled ?

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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 2, 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 May 2, 2023

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 18.01% ( 1993 / 11065 )
Methods: 8.1% ( 116 / 1432 )
Lines: 20.81% ( 1750 / 8408 )
Branches: 10.37% ( 127 / 1225 )

@github-actions
Copy link

github-actions bot commented May 2, 2023

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 32.41% ( 176 / 543 )
Methods: 21.25% ( 17 / 80 )
Lines: 39.25% ( 157 / 400 )
Branches: 3.17% ( 2 / 63 )

@github-actions
Copy link

github-actions bot commented May 2, 2023

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 68.32% ( 371 / 543 )
Methods: 57.97% ( 40 / 69 )
Lines: 70.47% ( 327 / 464 )
Branches: 40% ( 4 / 10 )

@github-actions
Copy link

github-actions bot commented May 2, 2023

E2E SIMS API Coverage Report

Totals Coverage
Statements: 39.96% ( 2729 / 6829 )
Methods: 32.96% ( 293 / 889 )
Lines: 45.26% ( 2305 / 5093 )
Branches: 15.47% ( 131 / 847 )

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.

Great work 👍

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 4353c0b into main May 2, 2023
@andrewsignori-aot andrewsignori-aot temporarily deployed to DEV May 2, 2023 23:45 — with GitHub Actions Inactive
@andrewsignori-aot andrewsignori-aot deleted the feature/#1864-msfaa-receive-file-e2e-test branch May 2, 2023 23:45
@andrewsignori-aot andrewsignori-aot temporarily deployed to DEV May 2, 2023 23:46 — with GitHub Actions Inactive
@andrewsignori-aot andrewsignori-aot temporarily deployed to DEV May 2, 2023 23:59 — 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.

5 participants