-
Notifications
You must be signed in to change notification settings - Fork 3
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) Unit test for updating pacakges #1007
Conversation
Coverage Report
File Coverage
|
@@ -35,7 +37,7 @@ const items: Record<string, TestItemResult> = { | |||
actionType: "New", | |||
}, | |||
}, | |||
["VA"]: { | |||
[WEIRD_ID]: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a certain check that wants to make sure an ID is just a wrong format for an item but it exist with in our system hence "weird"
const resultPackage = await handler(noActionevent); | ||
|
||
expect(resultPackage.statusCode).toBe(400); | ||
const noApackageEvent = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should probably split these into two tests just for clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split
@@ -102,7 +102,7 @@ const sendUpdateIdMessage = async ({ | |||
...remainingFields | |||
} = currentPackage._source; | |||
|
|||
if (!updatedId) { | |||
if (updatedId === currentPackage._id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be if (!updatedId || updatedId === currentPackage._id) {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its impossible for updatedId to not exist. Its set to default to packageId if one is not provided on line 192.
🎫 Linked Ticket
Ticket to close
💬 Description / Notes
Adding unit test coverage for the update lambda
🛠 Changes
Removed some unhittable exceptions we were doing. Since the zod object was verifying fields there was just a couple things not matter what you couldn't hit.
I also refactored some code by moving it around a little to make sure we are returning the values we want to in some cases.
📸 Screenshots / Demo