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

feat(test)-submit lambda #987

Merged
merged 8 commits into from
Jan 8, 2025
Merged

feat(test)-submit lambda #987

merged 8 commits into from
Jan 8, 2025

Conversation

thwalker6
Copy link
Collaborator

@thwalker6 thwalker6 commented Jan 8, 2025

🎫 Linked Ticket

Ticket to close

💬 Description / Notes

This is for unit testing of our submit function

🛠 Changes

No changes, just new test

📸 Screenshots / Demo

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.97% 6998 / 8861
🔵 Statements 77.98% 7312 / 9376
🔵 Functions 70.67% 2041 / 2888
🔵 Branches 47.88% 1325 / 2767
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
lib/lambda/search.test.ts 100% 100% 100% 100%
lib/lambda/submit/index.test.ts 99.23% 100% 96.29% 99.23% 34
lib/lambda/submit/indexMissingAttachments.test.ts 97.84% 100% 91.3% 97.84% 14, 18
lib/lambda/submit/submissionPayloads/capitated-amendment.ts 81.25% 62.5% 100% 86.66% 9, 18, 23
lib/lambda/submit/submissionPayloads/upload-subsequent-documents.ts 85.71% 66.66% 100% 92.3% 7, 14
lib/libs/api/auth/user.ts 96.22% 89.28% 100% 96.22% 48, 86
Generated in workflow #1405 for commit a198821 by the Vitest Coverage Report Action

@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 16:45 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-kibana January 8, 2025 16:47 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 16:47 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 16:47 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-app January 8, 2025 16:47 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 16:47 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:29 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:29 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:31 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:31 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-kibana January 8, 2025 17:31 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-app January 8, 2025 17:31 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:31 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:57 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 17:57 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:00 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:00 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-kibana January 8, 2025 18:00 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-app January 8, 2025 18:00 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:00 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:28 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:28 — with GitHub Actions Inactive
@@ -29,7 +29,7 @@ describe("getSearchData Handler", () => {
const body = JSON.parse(res.body);
expect(body).toBeTruthy();
expect(body?.hits?.hits).toBeTruthy();
expect(body?.hits?.hits?.length).toEqual(11);
expect(body?.hits?.hits?.length).toEqual(12);
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 added a new object that gets pulled into the search

@@ -0,0 +1,160 @@
const capitatedAmendmentBase = {
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 file causes the zod errors that get caught in each particular submission event

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you re-use the base amendments and use override the attachments for the tests? like

{
    ...base.capitatedAmendmentBase,
    attachments: {}
}

@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:36 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:36 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:39 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-kibana January 8, 2025 18:39 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:39 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test January 8, 2025 18:39 — with GitHub Actions Inactive
@thwalker6 thwalker6 temporarily deployed to submit-lambda-test-app January 8, 2025 18:39 — with GitHub Actions Inactive
Copy link
Collaborator

@thetif thetif 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! minor suggestions

});
it("should have no event in the body", async () => {
const event = {
body: `{"event": ""}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could use JSON.stringify() here, I think that's what the other tests are doing for event bodies

requestContext: getRequestContext(),
} as unknown as APIGatewayEvent;
const result = await submit(event);
expect(result.statusCode).toEqual(500);
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we check for the error message too?

process.env.brokerString = brokerString;
});

it("should start to create an capitated ammendment event", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have a little more info in these test names? like "should fail creating a capitated amendment event because..."

@@ -0,0 +1,160 @@
const capitatedAmendmentBase = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you re-use the base amendments and use override the attachments for the tests? like

{
    ...base.capitatedAmendmentBase,
    attachments: {}
}

@thwalker6 thwalker6 merged commit 6fab5d0 into main Jan 8, 2025
14 of 15 checks passed
RanyeM pushed a commit that referenced this pull request Jan 9, 2025
* feat(test)-submit lambda

* Update withdrawpackage to withdrawrai

* linter corrections

* Fix some test

* Test for malformed objects

* Remove import vs code added in

* remove console.log

* Updatign to use get requestcontext
RanyeM added a commit that referenced this pull request Jan 9, 2025
* feature: adding new FAQ to FAQ page

* feature: question should open corresponding section

* fix: corrected code back to faq page direct link

* fix: removed id

* fix: #5 and #6 to expanded section

* fix: test coverage

* revert package json to what is on main

* fix(email): Fixes an issue with Outlook not correctly displaying the OneMAC logo and header (#972)

* fixed index test

* fix(test): Create mock for calling lambdas (#973)

* Added msw endpoints for Lambda, Step Functions, Secure Token Services, and other related services
* Added/updated test data to support new endpoints
* Updated tests to use the new endpoints instead of mocking individually

* fix(email): switch email logo back to using url

* fix(schema): remove logic for determining next business day for `submissionDate` (#980)

* fix: remove logic for determining next business day for `submissionDate`

* fix: update `submissionDate` value

* feat(ui): Remove status date from package details pages for all users (#965)

* fix(initial verbiage fix): Email verbiage fixes from qa (#974)

* correct verbage for med and chip spa

* fix issues with verbiage need confirmation

* remove comment

* add date and attachment logic

* update snapshots

* Update ChipSpaState.tsx

* test(email): proces email test (#979)

* feat(test)proces email test

* Removed console.log

* linter correction

* removed a ine

* remove brackets

* add region

* Address change reqeust

* feat(test)-submit lambda (#987)

* feat(test)-submit lambda

* Update withdrawpackage to withdrawrai

* linter corrections

* Fix some test

* Test for malformed objects

* Remove import vs code added in

* remove console.log

* Updatign to use get requestcontext

* feat(test) fix email test (#991)

* feat(test) fix email test
* Update processEmails.test.ts

* fix(os) helpers for getting domain and index for opensearch (#992)

* created helpers for getting domain and index for opensearch
* fixed import

* feat(test) updates to s3 calls on backend (#985)

* updates to s3 calls on backend

* feat(test)-unauthorized submission test (#996)

* feat(amend): Add waiver amendment emails (#993)

* Feat(playwright performance): Pw perf tests (#959)

* feat: initial perf tests for routes

fix: refactor

* Fix: updated per review comments

---------

Co-authored-by: asharonbaltazar <[email protected]>

---------

Co-authored-by: 13bfrancis <[email protected]>
Co-authored-by: Ty Bolt <[email protected]>
Co-authored-by: Tiffany Forkner <[email protected]>
Co-authored-by: asharonbaltazar <[email protected]>
Co-authored-by: James Dinh <[email protected]>
Co-authored-by: Thomas Walker <[email protected]>
Co-authored-by: Benjamin Paige <[email protected]>
Co-authored-by: Jon Schaffer <[email protected]>
Copy link
Contributor

github-actions bot commented Jan 9, 2025

🎉 This PR is included in version 1.5.0-val.103 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@asharonbaltazar asharonbaltazar deleted the submit-lambda-test branch January 13, 2025 18:54
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.

2 participants