From 40d1f9beedfc0fcc2b19ec5a2abfecfa244bf204 Mon Sep 17 00:00:00 2001 From: Oscar Ivan Date: Mon, 19 May 2025 10:22:01 -0600 Subject: [PATCH] test: Add an extra test for membership repository. Check that the repository returns a populated collection of memberships --- test/cases/membership.repository.case.ts | 11 +++++--- test/results.md | 33 ------------------------ 2 files changed, 8 insertions(+), 36 deletions(-) delete mode 100644 test/results.md diff --git a/test/cases/membership.repository.case.ts b/test/cases/membership.repository.case.ts index fd26e2f..7d97805 100644 --- a/test/cases/membership.repository.case.ts +++ b/test/cases/membership.repository.case.ts @@ -16,6 +16,7 @@ export const membershipRepositoryTestCase = () => { let allPeriods: Array[]; beforeAll(async () => { + process.env.MONGO_CONNECTION_STRING = "dummy"; allMemberships = loadTestJson(__dirname, 'allMemberships.json'); allPeriods = loadTestJson(__dirname, 'allMembershipsPeriods.json'); @@ -43,12 +44,16 @@ export const membershipRepositoryTestCase = () => { it('Should get all memberships', async () => { const allExistingMemberships = await membershipRepository.getAllMemberships(); + + expect(allExistingMemberships.length).toBeGreaterThan(0); + }); + + it('Should return all memberships with valid schema structure', async () => { + const allExistingMemberships = await membershipRepository.getAllMemberships(); const expectedShape = membershipSchema; allExistingMemberships.forEach(membership => { expect(membership).toEqual(expect.objectContaining(expectedShape)); }); - - }); - + }); }; \ No newline at end of file diff --git a/test/results.md b/test/results.md deleted file mode 100644 index e7bbd90..0000000 --- a/test/results.md +++ /dev/null @@ -1,33 +0,0 @@ -# Eversports test cases results - - -| :clock10: Start time | :hourglass: Duration | -| --- | ---: | -|19/05/2025, 1:52:40 am|2.204 s| - -| | :white_check_mark: Passed | :x: Failed | :construction: Todo | :white_circle: Total | -| --- | ---: | ---: | ---:| ---: | -|Test Suites|1|0|-|1| -|Tests|8|0|0|8| - -## test/main.test.ts [[link](https://github.com/maleficarum/eversports/blob/2301420538749256af199b3614be4cdf7d96bdc0/test/main.test.ts)] - -8 passed, 0 failed, 0 todo, done in 2.129 s - -- :white_check_mark: Test app startup - - :white_check_mark: should has a list all health information -- :white_check_mark: Test membership controller - - :white_check_mark: Membership controller tests - - :white_check_mark: should have registered routes -- :white_check_mark: Test membership repository - - :white_check_mark: Should get all memberships -- :white_check_mark: Test membership creation rules - - :white_check_mark: Cash method validation - - :white_check_mark: should validate recurring price gt 100 for cash mayment method - - :white_check_mark: Monthly billing interval validation - - :white_check_mark: should validate billing period gt 12 for monthly billing interval - - :white_check_mark: should validate billing period lt 6 for monthly billing interval - - :white_check_mark: Yearly billing interval validation - - :white_check_mark: should validate billing period gt 10 years - - :white_check_mark: should validate billing period lt 3 years -