Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions migrations/v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ describe('MCQ - v4.1.0 to v4.2.0', async () => {
});
mutateContent('MCQ - add item _isPartlyCorrect attribute', async (content) => {
MCQs.forEach(MCQ => {
MCQ._items.forEach(item => {
MCQ._items?.forEach(item => {
item._isPartlyCorrect = false;
});
});
return true;
});
mutateContent('MCQ - add item _score attribute', async (content) => {
MCQs.forEach(MCQ => {
MCQ._items.forEach(item => {
MCQ._items?.forEach(item => {
item._score = 0;
});
});
Expand All @@ -193,14 +193,14 @@ describe('MCQ - v4.1.0 to v4.2.0', async () => {
});
checkContent('MCQ - check item _isPartlyCorrect attribute', async(content) => {
const isValid = MCQs.every(MCQ => {
return MCQ._items.every(item => _.has(item, '_isPartlyCorrect'));
return (MCQ._items ?? []).every(item => _.has(item, '_isPartlyCorrect'));
});
if (!isValid) throw new Error('MCQ - no item _isPartlyCorrect found');
return true;
});
checkContent('MCQ - check item _score attribute', async(content) => {
const isValid = MCQs.every(MCQ => {
return MCQ._items.every(item => _.has(item, '_score'));
return (MCQ._items ?? []).every(item => _.has(item, '_score'));
});
if (!isValid) throw new Error('MCQ - no item _score found');
return true;
Expand Down
4 changes: 2 additions & 2 deletions migrations/v7.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ describe('MCQ - v7.3.11 to v7.4.0', async () => {
});
mutateContent('MCQ - add altText attribute to _items', async (content) => {
MCQs.forEach(MCQ => {
MCQ._items.forEach(item => {
MCQ._items?.forEach(item => {
item.altText = '';
});
});
return true;
});
checkContent('MCQ - check item altText attribute', async (content) => {
const isValid = MCQs.every(MCQ => {
return MCQ._items.every(item => _.has(item, 'altText'));
return (MCQ._items ?? []).every(item => _.has(item, 'altText'));
});
if (!isValid) throw new Error('MCQ - no item altText found');
return true;
Expand Down
Loading