-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(api): introduce refreshLearningContentCache usecase
- Loading branch information
Showing
5 changed files
with
28 additions
and
43 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
4 changes: 4 additions & 0 deletions
4
api/src/shared/domain/usecases/refresh-learning-content-cache.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,4 @@ | ||
const refreshLearningContentCache = async function ({ lcmsRefreshCacheJob }) { | ||
await lcmsRefreshCacheJob.schedule(); | ||
}; | ||
export { refreshLearningContentCache }; |
15 changes: 15 additions & 0 deletions
15
api/tests/shared/unit/domain/usecases/refresh-learning-content-cache_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,15 @@ | ||
import { refreshLearningContentCache } from '../../../../../src/shared/domain/usecases/refresh-learning-content-cache.js'; | ||
import { expect, sinon } from '../../../../test-helper.js'; | ||
|
||
describe('Unit | Domain | Usecases | Refresh Learning Content Cache', function () { | ||
it('should use repository to schedule reefresh job', async function () { | ||
// given | ||
const lcmsRefreshCacheJob = { schedule: sinon.stub() }; | ||
|
||
// when | ||
await refreshLearningContentCache({ lcmsRefreshCacheJob }); | ||
|
||
// then | ||
expect(lcmsRefreshCacheJob.schedule).to.have.been.calledOnce; | ||
}); | ||
}); |
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