diff --git a/api/src/identity-access-management/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.js b/api/src/identity-access-management/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.js new file mode 100644 index 00000000000..47bc80dc16a --- /dev/null +++ b/api/src/identity-access-management/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.js @@ -0,0 +1,14 @@ +/** + * @typedef {import ('../../domain/usecases/index.js').UserRepository} UserRepository + */ + +/** + * @param {Object} params + * @param {number} params.userId + * @param {UserRepository} params.userRepository + */ +const markAssessmentInstructionsInfoAsSeen = function ({ userId, userRepository }) { + return userRepository.updateHasSeenAssessmentInstructionsToTrue(userId); +}; + +export { markAssessmentInstructionsInfoAsSeen }; diff --git a/api/tests/identity-access-management/integration/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.test.js b/api/tests/identity-access-management/integration/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.test.js new file mode 100644 index 00000000000..a8ca54a8cf6 --- /dev/null +++ b/api/tests/identity-access-management/integration/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.test.js @@ -0,0 +1,21 @@ +import { usecases } from '../../../../../src/identity-access-management/domain/usecases/index.js'; +import { databaseBuilder, expect } from '../../../../test-helper.js'; + +describe('Integration | Identity Access Management | Domain | UseCase | markAssessmentInstructionsInfoAsSeen', function () { + it('should update hasSeenAssessmentInstructions property as true for the user', async function () { + // given + const user = databaseBuilder.factory.buildUser({ + email: 'myusertoupdate@example.net', + hasSeenAssessmentInstructions: false, + }); + await databaseBuilder.commit(); + + // when + const result = await usecases.markAssessmentInstructionsInfoAsSeen({ + userId: user.id, + }); + + // then + expect(result.hasSeenAssessmentInstructions).to.be.true; + }); +});