Skip to content

Commit

Permalink
feat(api): add mark assessment info usecase
Browse files Browse the repository at this point in the history
  • Loading branch information
Libouk committed Dec 2, 2024
1 parent 2f2f8d3 commit 316bd82
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 };
Original file line number Diff line number Diff line change
@@ -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: '[email protected]',
hasSeenAssessmentInstructions: false,
});
await databaseBuilder.commit();

// when
const result = await usecases.markAssessmentInstructionsInfoAsSeen({
userId: user.id,
});

// then
expect(result.hasSeenAssessmentInstructions).to.be.true;
});
});

0 comments on commit 316bd82

Please sign in to comment.