Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
RamRamez committed Oct 2, 2024
1 parent e8a0aaa commit bd7c70e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"test:qfRoundHistoryRepository": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/repositories/qfRoundHistoryRepository.test.ts",
"test:qfRoundService": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/qfRoundService.test.ts",
"test:project": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/entities/project.test.ts",
"test:projectsTab": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/server/adminJs/tabs/projectsTab.test.ts",
"test:syncUsersModelScore": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/cronJobs/syncUsersModelScore.test.ts",
"test:notifyDonationsWithSegment": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/cronJobs/notifyDonationsWithSegment.test.ts",
"test:checkProjectVerificationStatus": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/cronJobs/checkProjectVerificationStatus.test.ts",
Expand Down
38 changes: 30 additions & 8 deletions src/server/adminJs/tabs/projectsTab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
addFeaturedProjectUpdate,
exportProjectsWithFiltersToCsv,
listDelist,
revokeGivbacksEligibility,
updateStatusOfProjects,
verifyProjects,
} from './projectsTab';
Expand Down Expand Up @@ -452,7 +453,20 @@ function verifyProjectsTestCases() {
recordIds: String(project.id),
},
},
true, // give priority to revoke badge
false,
);
await revokeGivbacksEligibility(
{
currentAdmin: adminUser as User,
h: {},
resource: {},
records: [],
},
{
query: {
recordIds: String(project.id),
},
},
);

const updatedProject = await findProjectById(project.id);
Expand Down Expand Up @@ -526,15 +540,20 @@ function verifyProjectsTestCases() {
assert.isTrue(updatedProject?.listed);
assert.equal(updatedProject?.reviewStatus, ReviewStatus.Listed);
assert.isTrue(project!.verificationStatus === RevokeSteps.Revoked);
assert.isTrue(updatedProject!.verificationStatus === null);
assert.isTrue(
updatedProject!.verificationStatus === project.verificationStatus,
);
assert.equal(
updatedVerificationForm!.status,
PROJECT_VERIFICATION_STATUSES.VERIFIED,
PROJECT_VERIFICATION_STATUSES.DRAFT,
);
assert.equal(
updatedVerificationForm!.isTermAndConditionsAccepted,
projectVerificationForm.isTermAndConditionsAccepted,
);
assert.equal(updatedVerificationForm!.isTermAndConditionsAccepted, true);
assert.equal(
updatedVerificationForm!.lastStep,
PROJECT_VERIFICATION_STEPS.SUBMIT,
projectVerificationForm.lastStep,
);
});

Expand Down Expand Up @@ -615,12 +634,15 @@ function verifyProjectsTestCases() {
assert.isTrue(updatedProject!.verificationStatus === RevokeSteps.Revoked);
assert.equal(
updatedVerificationForm!.status,
PROJECT_VERIFICATION_STATUSES.DRAFT,
PROJECT_VERIFICATION_STATUSES.VERIFIED,
);
assert.equal(
updatedVerificationForm!.isTermAndConditionsAccepted,
projectVerificationForm.isTermAndConditionsAccepted,
);
assert.equal(updatedVerificationForm!.isTermAndConditionsAccepted, false);
assert.equal(
updatedVerificationForm!.lastStep,
PROJECT_VERIFICATION_STEPS.MANAGING_FUNDS,
projectVerificationForm.lastStep,
);
});

Expand Down

0 comments on commit bd7c70e

Please sign in to comment.