Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
thewatermethod committed Apr 19, 2024
1 parent af47217 commit f7be8c0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/goalServices/getGoalIdsBySimiliarity.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jest/no-conditional-expect */
import faker from '@faker-js/faker';
import { REPORT_STATUSES } from '@ttahub/common';
import {
Expand Down Expand Up @@ -808,10 +807,15 @@ describe('getGoalIdsBySimilarity', () => {
expect(goalGroupSimilarityGroupGoals).toHaveLength(goalGroup.length);

goalGroupSimilarityGroupGoals.forEach((g) => {
let creationMethod = expect.any(String);
let status = expect.any(String);
if (g.excludedIfNotAdmin) {
expect(g.goal.goalTemplate.creationMethod).toBe(CREATION_METHOD.CURATED);
expect(g.goal.status).toBe(GOAL_STATUS.CLOSED);
creationMethod = CREATION_METHOD.CURATED;
status = GOAL_STATUS.CLOSED;
}

expect(g.goal.goalTemplate.creationMethod).toBe(creationMethod);
expect(g.goal.status).toBe(status);
});

const excludedIfNotAdminGoalGroup = goalGroupSimilarityGroupGoals
Expand Down Expand Up @@ -873,12 +877,16 @@ describe('getGoalIdsBySimilarity', () => {
expect(goalGroupSimilarityGroupGoals).toHaveLength(goalGroup.length);

goalGroupSimilarityGroupGoals.forEach((g) => {
let creationMethod = expect.any(String);
let status = expect.any(String);
if (g.excludedIfNotAdmin) {
expect(g.goal.goalTemplate.creationMethod).toBe(CREATION_METHOD.CURATED);
expect(g.goal.status).toBe(GOAL_STATUS.CLOSED);
creationMethod = CREATION_METHOD.CURATED;
status = GOAL_STATUS.CLOSED;
}
});

expect(g.goal.goalTemplate.creationMethod).toBe(creationMethod);
expect(g.goal.status).toBe(status);
});
const allowedIfNotAdmin = goalGroupSimilarityGroupGoals
.filter((g) => !g.excludedIfNotAdmin).map((g) => g.goal.id);

Expand Down

0 comments on commit f7be8c0

Please sign in to comment.