Skip to content

SSF-197 Allocation Service Tests#165

Open
Juwang110 wants to merge 1 commit intomainfrom
jw/ssf-197-allocation-service-test
Open

SSF-197 Allocation Service Tests#165
Juwang110 wants to merge 1 commit intomainfrom
jw/ssf-197-allocation-service-test

Conversation

@Juwang110
Copy link
Copy Markdown

ℹ️ Issue

Closes https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?jql=assignee%20%3D%20712020%3A10ef9ad9-e290-4bbd-8c4b-cb215e8d449a&selectedIssue=SSF-197

📝 Description

Removed allocations controller and added service.spec file with tests for service functions.

✔️ Verification

Added tests and made sure they passed

🏕️ (Optional) Future Work / Notes

N/A

Copy link
Copy Markdown
Member

@amywng amywng left a comment

Choose a reason for hiding this comment

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

could you also add a test that the transaction manager doesn't apply any changes if an error/exception is thrown during the transaction?

`SELECT reserved_quantity FROM donation_items WHERE item_id = $1`,
[itemId],
);
expect(Number(reserved_quantity)).toBe(33);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you add a check that the reserved quantity is 30 before

`SELECT reserved_quantity FROM donation_items WHERE item_id = $1`,
[itemId2],
);
expect(Number(item1.reserved_quantity)).toBe(35);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

expect(Number(item2.reserved_quantity)).toBe(22);
});

it('should throw BadRequestException for orderId of 0', async () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think we said we don't need these since we alr test the validate function elsewhere (this test and the two below)

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.

2 participants