Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Sep 6, 2024
1 parent 55ed9a2 commit d8cdcae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/editors/data/redux/thunkActions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const initialize = (data) => (dispatch) => {
const editorType = data.blockType;
dispatch(actions.app.initialize(data));
dispatch(module.fetchBlock());
if (data.blockId.startsWith('block-v1:')) {
if (data.blockId?.startsWith('block-v1:')) {
dispatch(module.fetchUnit());
}
switch (editorType) {
Expand All @@ -102,7 +102,7 @@ export const initialize = (data) => (dispatch) => {
dispatch(module.fetchCourseDetails());
break;
case 'html':
if (data.learningContextId.startsWith('lib:')) {
if (data.learningContextId?.startsWith('lib:')) {
// eslint-disable-next-line no-console
console.log('Not fetching image assets - not implemented yet for content libraries.');
} else {
Expand Down
7 changes: 6 additions & 1 deletion src/editors/data/redux/thunkActions/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ describe('app thunkActions', () => {
expect(dispatch.mock.calls).toEqual([
[actions.app.initialize(testValue)],
[thunkActions.fetchBlock()],
[thunkActions.fetchUnit()],
]);
thunkActions.fetchBlock = fetchBlock;
thunkActions.fetchUnit = fetchUnit;
Expand Down Expand Up @@ -216,6 +215,8 @@ describe('app thunkActions', () => {
const data = {
...testValue,
blockType: 'html',
blockId: 'block-v1:UniversityX+PHYS+1+type@problem+block@123',
learningContextId: 'course-v1:UniversityX+PHYS+1',
};
thunkActions.initialize(data)(dispatch);
expect(dispatch.mock.calls).toEqual([
Expand Down Expand Up @@ -251,6 +252,8 @@ describe('app thunkActions', () => {
const data = {
...testValue,
blockType: 'problem',
blockId: 'block-v1:UniversityX+PHYS+1+type@problem+block@123',
learningContextId: 'course-v1:UniversityX+PHYS+1',
};
thunkActions.initialize(data)(dispatch);
expect(dispatch.mock.calls).toEqual([
Expand Down Expand Up @@ -286,6 +289,8 @@ describe('app thunkActions', () => {
const data = {
...testValue,
blockType: 'video',
blockId: 'block-v1:UniversityX+PHYS+1+type@problem+block@123',
learningContextId: 'course-v1:UniversityX+PHYS+1',
};
thunkActions.initialize(data)(dispatch);
expect(dispatch.mock.calls).toEqual([
Expand Down

0 comments on commit d8cdcae

Please sign in to comment.