Skip to content

Commit 6cadbff

Browse files
xav-carlaura-bergoens
authored andcommitted
feat(api): add test to explicity success without requirement
1 parent b48fedb commit 6cadbff

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

api/db/seeds/data/team-prescription/build-quests.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function buildParenthoodQuest(databaseBuilder) {
2727
databaseBuilder.factory.buildQuest({
2828
rewardType: REWARD_TYPES.ATTESTATION,
2929
rewardId,
30+
successRequirements: [],
3031
eligibilityRequirements: [
3132
{
3233
requirement_type: REQUIREMENT_TYPES.OBJECT.CAMPAIGN_PARTICIPATIONS,

api/tests/quest/unit/domain/models/Quest_test.js

+18
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ describe('Quest | Unit | Domain | Models | Quest ', function () {
5757
});
5858

5959
describe('#isSuccessful', function () {
60+
it('returns true when successfulRequirement is empty', function () {
61+
// given
62+
const quest = new Quest({
63+
eligibilityRequirements: [],
64+
successRequirements: [],
65+
});
66+
const success = new Success({
67+
knowledgeElements: [
68+
{ status: KnowledgeElement.StatusType.VALIDATED, skillId: 'skillA' },
69+
{ status: KnowledgeElement.StatusType.VALIDATED, skillId: 'skillB' },
70+
{ status: KnowledgeElement.StatusType.VALIDATED, skillId: 'skillC' },
71+
{ status: KnowledgeElement.StatusType.VALIDATED, skillId: 'skillD' },
72+
],
73+
});
74+
75+
expect(quest.isSuccessful(success)).to.be.true;
76+
});
77+
6078
it('returns true when all requirements are met', function () {
6179
// given
6280
const quest = new Quest({

0 commit comments

Comments
 (0)