|
| 1 | +import { KnowledgeElementCollection } from '../../../../../../src/prescription/shared/domain/models/KnowledgeElementCollection.js'; |
| 2 | +import { KnowledgeElement } from '../../../../../../src/shared/domain/models/index.js'; |
| 3 | +import { databaseBuilder, domainBuilder } from '../../../../../test-helper.js'; |
| 4 | + |
| 5 | +describe('Integration | UseCases | storeCampaignParticipationLevelPerTube', function () { |
| 6 | + describe('compute', function () { |
| 7 | + let campaignParticipationId; |
| 8 | + |
| 9 | + beforeEach(function () { |
| 10 | + const learningContentData = { |
| 11 | + frameworks: [ |
| 12 | + { |
| 13 | + id: 'frameworkId', |
| 14 | + name: 'frameworkName', |
| 15 | + areas: [ |
| 16 | + { |
| 17 | + id: 'recArea1', |
| 18 | + frameworkId: 'frameworkId', |
| 19 | + competenceIds: ['recCompetence1'], |
| 20 | + competences: [ |
| 21 | + { |
| 22 | + id: 'recCompetence1', |
| 23 | + index: '1.1', |
| 24 | + name: 'nom de la competence', |
| 25 | + description: 'description de la competence', |
| 26 | + areaId: 'recArea1', |
| 27 | + origin: 'Pix', |
| 28 | + tubes: [ |
| 29 | + { |
| 30 | + id: 'recTube1', |
| 31 | + practicalTitle: 'tube1', |
| 32 | + practicalDescription: 'tube1 description', |
| 33 | + competenceId: 'recCompetence1', |
| 34 | + skills: [ |
| 35 | + { |
| 36 | + id: 'recSkillWeb1', |
| 37 | + name: '@web1', |
| 38 | + status: 'actif', |
| 39 | + difficulty: 1, |
| 40 | + }, |
| 41 | + { |
| 42 | + id: 'recSkillWeb2', |
| 43 | + name: '@web2', |
| 44 | + status: 'actif', |
| 45 | + difficulty: 2, |
| 46 | + }, |
| 47 | + ], |
| 48 | + }, |
| 49 | + { |
| 50 | + id: 'recTube2', |
| 51 | + practicalTitle: 'tube2', |
| 52 | + practicalDescription: 'tube2 description', |
| 53 | + competenceId: 'recCompetence1', |
| 54 | + skills: [ |
| 55 | + { |
| 56 | + id: 'recSkillUrl1', |
| 57 | + name: '@url1', |
| 58 | + status: 'actif', |
| 59 | + difficulty: 3, |
| 60 | + }, |
| 61 | + { |
| 62 | + id: 'recSkillUrl2', |
| 63 | + name: '@url2', |
| 64 | + status: 'actif', |
| 65 | + difficulty: 4, |
| 66 | + }, |
| 67 | + ], |
| 68 | + }, |
| 69 | + ], |
| 70 | + }, |
| 71 | + ], |
| 72 | + }, |
| 73 | + ], |
| 74 | + }, |
| 75 | + ], |
| 76 | + }; |
| 77 | + |
| 78 | + const userId = databaseBuilder.factory.buildUser({}).id; |
| 79 | + const campaignId = databaseBuilder.factory.buildCampaign().id; |
| 80 | + campaignParticipationId = databaseBuilder.factory.buildCampaignParticipation({ |
| 81 | + campaignId, |
| 82 | + userId, |
| 83 | + }).id; |
| 84 | + |
| 85 | + domainBuilder.buildLearningContent(learningContentData.frameworks); |
| 86 | + |
| 87 | + const ke1 = domainBuilder.buildKnowledgeElement({ |
| 88 | + status: KnowledgeElement.StatusType.INVALIDATED, |
| 89 | + skillId: 'skill1', |
| 90 | + userId: 1, |
| 91 | + }); |
| 92 | + |
| 93 | + const ke2 = domainBuilder.buildKnowledgeElement({ |
| 94 | + status: KnowledgeElement.StatusType.VALIDATED, |
| 95 | + skillId: 'skill2', |
| 96 | + userId: 1, |
| 97 | + }); |
| 98 | + |
| 99 | + databaseBuilder.factory.buildCampaignSkill({ campaignId, skillId: 'skill1' }); |
| 100 | + databaseBuilder.factory.buildCampaignSkill({ campaignId, skillId: 'skill2' }); |
| 101 | + |
| 102 | + const snapshot = new KnowledgeElementCollection([ke1, ke2]).toSnapshot(); |
| 103 | + |
| 104 | + databaseBuilder.factory.buildKnowledgeElementSnapshot({ campaignParticipationId: 1, snapshot }); |
| 105 | + |
| 106 | + databaseBuilder.commit(); |
| 107 | + }); |
| 108 | + |
| 109 | + it('should store the reached level per tube', function () { |
| 110 | + expect(true).equal(true); |
| 111 | + }); |
| 112 | + }); |
| 113 | +}); |
0 commit comments