-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ api: receive pb-boss job into handler
- Loading branch information
Showing
8 changed files
with
141 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { assertNotNullOrUndefined } from '../../../src/shared/domain/models/asserts.js'; | ||
|
||
export default class CertificationRescoredByScript { | ||
/** | ||
* @param {Object} params | ||
* @param {number} params.certificationCourseId - certification course that will be rescored | ||
*/ | ||
constructor({ certificationCourseId }) { | ||
assertNotNullOrUndefined(certificationCourseId); | ||
this.certificationCourseId = certificationCourseId; | ||
} | ||
} |
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
15 changes: 9 additions & 6 deletions
15
...ification/session-management/infrastructure/jobs/CertificationRescoringByScriptHandler.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
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
23 changes: 23 additions & 0 deletions
23
...session-management/unit/infrastructure/jobs/CertificationRescoringByScriptHandler_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,23 @@ | ||
import CertificationRescoredByScript from '../../../../../../lib/domain/events/CertificationRescoredByScript.js'; | ||
import { CertificationRescoringByScriptJobHandler } from '../../../../../../src/certification/session-management/infrastructure/jobs/CertificationRescoringByScriptHandler.js'; | ||
import { expect, sinon } from '../../../../../test-helper.js'; | ||
|
||
describe('Certification | session-management | Unit | Jobs | CertificationRescoringByScriptHandler', function () { | ||
it('should call usecase with given certificationCourseId', async function () { | ||
// given | ||
const certificationCourseId = 1; | ||
const eventDispatcherStub = { | ||
dispatch: sinon.stub(), | ||
}; | ||
|
||
const handler = new CertificationRescoringByScriptJobHandler({ eventDispatcher: eventDispatcherStub }); | ||
|
||
// when | ||
await handler.handle({ certificationCourseId }); | ||
|
||
// then | ||
expect(eventDispatcherStub.dispatch).to.have.been.calledWithExactly( | ||
new CertificationRescoredByScript({ certificationCourseId }), | ||
); | ||
}); | ||
}); |
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