-
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.
[BUGFIX] Permettre la finalisation des sessions ayant à la fois des c…
- Loading branch information
Showing
5 changed files
with
61 additions
and
75 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
30 changes: 30 additions & 0 deletions
30
...sts/certification/session-management/integration/domain/usecases/finalize-session_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,30 @@ | ||
import { SessionWithAbortReasonOnCompletedCertificationCourseError } from '../../../../../../src/certification/session-management/domain/errors.js'; | ||
import { usecases } from '../../../../../../src/certification/session-management/domain/usecases/index.js'; | ||
import { ABORT_REASONS } from '../../../../../../src/certification/shared/domain/models/CertificationCourse.js'; | ||
import { catchErr, databaseBuilder, expect, knex } from '../../../../../test-helper.js'; | ||
|
||
describe('Certification | Session Management | Integration | Domain | UseCase | Finalize Session ', function () { | ||
context('When there is an abort reason for completed certification course', function () { | ||
it('should throw an SessionWithAbortReasonOnCompletedCertificationCourseError error', async function () { | ||
const certificationCourse = databaseBuilder.factory.buildCertificationCourse({ | ||
abortReason: ABORT_REASONS.CANDIDATE, | ||
completedAt: new Date(), | ||
}); | ||
await databaseBuilder.commit(); | ||
const certificationReports = [ | ||
{ certificationCourseId: certificationCourse.id, abortReason: ABORT_REASONS.CANDIDATE }, | ||
]; | ||
|
||
const err = await catchErr(usecases.finalizeSession)({ | ||
sessionId: certificationCourse.sessionId, | ||
certificationReports, | ||
}); | ||
|
||
expect(err).to.be.instanceOf(SessionWithAbortReasonOnCompletedCertificationCourseError); | ||
const updatedCertificationCourse = await knex('certification-courses') | ||
.where('id', certificationCourse.id) | ||
.first(); | ||
expect(updatedCertificationCourse.abortReason).to.be.null; | ||
}); | ||
}); | ||
}); |
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