-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TECH] Migrer la route de mise à jour Has Seen Assessment Instructions (
- Loading branch information
Showing
12 changed files
with
125 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-user-has-seen-assessment-instructions.js → ...-user-has-seen-assessment-instructions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const rememberUserHasSeenAssessmentInstructions = function ({ userId, userRepository }) { | ||
return userRepository.updateHasSeenAssessmentInstructionsToTrue(userId); | ||
return userRepository.updateAssessmentInstructionsInfoAsSeen({ userId }); | ||
}; | ||
|
||
export { rememberUserHasSeenAssessmentInstructions }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ty-access-management/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...-has-seen-assessment-instructions_test.js → ...-has-seen-assessment-instructions_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { rememberUserHasSeenAssessmentInstructions } from '../../../../lib/domain/usecases/remember-user-has-seen-assessment-instructions.js'; | ||
import { expect, sinon } from '../../../test-helper.js'; | ||
import { rememberUserHasSeenAssessmentInstructions } from '../../../../../src/evaluation/domain/usecases/remember-user-has-seen-assessment-instructions.js'; | ||
import { expect, sinon } from '../../../../test-helper.js'; | ||
|
||
describe('Unit | UseCase | remember-user-has-seen-assessment-instructions', function () { | ||
let userRepository; | ||
|
||
beforeEach(function () { | ||
userRepository = { updateHasSeenAssessmentInstructionsToTrue: sinon.stub() }; | ||
userRepository = { updateAssessmentInstructionsInfoAsSeen: sinon.stub() }; | ||
}); | ||
|
||
it('should update has seen assessment instructions', async function () { | ||
// given | ||
const userId = 'userId'; | ||
const updatedUser = Symbol('updateduser'); | ||
userRepository.updateHasSeenAssessmentInstructionsToTrue.resolves(updatedUser); | ||
userRepository.updateAssessmentInstructionsInfoAsSeen.resolves(updatedUser); | ||
|
||
// when | ||
const actualUpdatedUser = await rememberUserHasSeenAssessmentInstructions({ userId, userRepository }); | ||
|
||
// then | ||
expect(userRepository.updateHasSeenAssessmentInstructionsToTrue).to.have.been.calledWithExactly(userId); | ||
expect(userRepository.updateAssessmentInstructionsInfoAsSeen).to.have.been.calledWithExactly({ userId }); | ||
expect(actualUpdatedUser).to.equal(updatedUser); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
...ent/integration/domain/usecases/mark-assessment-instructions-info-as-seen.usecase.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters