Skip to content

Commit

Permalink
♻️ api: Add ComplementaryCertification model to enrolment
Browse files Browse the repository at this point in the history
  • Loading branch information
aceol committed May 22, 2024
1 parent a20a21a commit f427151
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @typedef {import ('../../../shared/domain/models/ComplementaryCertificationKeys.js').ComplementaryCertificationKeys} ComplementaryCertificationKeys
*/

export class ComplementaryCertification {
/**
* @param {Object} props
* @param {number} props.id
* @param {string} props.label
* @param {ComplementaryCertificationKeys|string} props.key identifier key
*/
constructor({ id, label, key } = {}) {
this.id = id;
this.label = label;
this.key = key;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { BookshelfCertificationCandidate } from '../../../../../lib/infrastructu
import * as bookshelfToDomainConverter from '../../../../../lib/infrastructure/utils/bookshelf-to-domain-converter.js';
import { logger } from '../../../../shared/infrastructure/utils/logger.js';
import { normalize } from '../../../../shared/infrastructure/utils/string-utils.js';
import { ComplementaryCertification } from '../../../complementary-certification/domain/models/ComplementaryCertification.js';
import { SubscriptionTypes } from '../../../shared/domain/models/SubscriptionTypes.js';
import { ComplementaryCertification } from '../../domain/models/ComplementaryCertification.js';

const linkToUser = async function ({ id, userId }) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import ('../../../session-management/infrastructure/repositories/index.js').ComplementaryCertificationApi} ComplementaryCertificationApi
* @typedef {import ('./index.js').ComplementaryCertificationApi} ComplementaryCertificationApi
*/
import { ComplementaryCertification } from '../../../session-management/domain/models/ComplementaryCertification.js';
import { ComplementaryCertification } from '../../domain/models/ComplementaryCertification.js';

/**
* @function
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ComplementaryCertification } from '../../../../../../src/certification/enrolment/domain/models/ComplementaryCertification.js';
import { domainBuilder, expect } from '../../../../../test-helper.js';

describe('Unit | Certification | Enrolment | Domain | Models | ComplementaryCertification', function () {
it('should return a complementary certification', function () {
// given
const complementaryCertification =
domainBuilder.certification.sessionManagement.buildCertificationSessionComplementaryCertification();

// when / then
expect(complementaryCertification).to.deepEqualInstance(new ComplementaryCertification(complementaryCertification));
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComplementaryCertification } from '../../../../../../src/certification/session-management/domain/models/ComplementaryCertification.js';
import { domainBuilder, expect } from '../../../../../test-helper.js';

describe('Unit | Certification | Session | Domain | Models | ComplementaryCertification', function () {
describe('Unit | Certification | Session-Management | Domain | Models | ComplementaryCertification', function () {
it('should return a complementary certification', function () {
// given
const complementaryCertification =
Expand Down

0 comments on commit f427151

Please sign in to comment.