fix: lint issues
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
"build": "make build",
|
||||
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
|
||||
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
||||
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
|
||||
"snapshot": "fedx-scripts jest --updateSnapshot",
|
||||
"start": "fedx-scripts webpack-dev-server --progress",
|
||||
"test": "fedx-scripts jest --coverage",
|
||||
|
||||
@@ -33,7 +33,7 @@ export const ScoringCard = ({
|
||||
summary += ` ${String.fromCharCode(183)} `;
|
||||
summary += unlimited
|
||||
? intl.formatMessage(messages.unlimitedAttemptsSummary)
|
||||
: intl.formatMessage(messages.attemptsSummary, { attempts: attempts ? attempts : defaultValue });
|
||||
: intl.formatMessage(messages.attemptsSummary, { attempts: attempts || defaultValue });
|
||||
return summary;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ from 'lodash-es';
|
||||
|
||||
import { ShowAnswerTypes, RandomizationTypesKeys } from '../../../data/constants/problem';
|
||||
|
||||
export const popuplateItem = (parentObject, itemName, statekey, metadata, allowNull=false) => {
|
||||
export const popuplateItem = (parentObject, itemName, statekey, metadata, allowNull = false) => {
|
||||
let parent = parentObject;
|
||||
const item = _.get(metadata, itemName, null);
|
||||
if (!_.isNil(item) || allowNull) {
|
||||
@@ -14,7 +14,7 @@ export const popuplateItem = (parentObject, itemName, statekey, metadata, allowN
|
||||
export const parseScoringSettings = (metadata, defaultSettings) => {
|
||||
let scoring = {};
|
||||
|
||||
let attempts = popuplateItem({}, 'max_attempts', 'number', metadata);
|
||||
const attempts = popuplateItem({}, 'max_attempts', 'number', metadata);
|
||||
attempts.unlimited = false;
|
||||
|
||||
// isFinite checks if value is a finite primitive number.
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('Test Settings to State Parser', () => {
|
||||
|
||||
test('Test score settings attempts missing with default max_attempts', () => {
|
||||
const scoreSettings = parseScoringSettings(singleSelectWithHints.metadata, defaultSettings);
|
||||
expect(scoreSettings.attempts).toStrictEqual({number: 1, unlimited: false});
|
||||
expect(scoreSettings.attempts).toStrictEqual({ number: 1, unlimited: false });
|
||||
});
|
||||
|
||||
test('Test negative attempts in score', () => {
|
||||
@@ -47,12 +47,12 @@ describe('Test Settings to State Parser', () => {
|
||||
|
||||
test('Test score settings missing with default', () => {
|
||||
const settings = parseSettings(singleSelectWithHints.metadata, defaultSettings);
|
||||
expect(settings.scoring).toStrictEqual({attempts: {number: 1, unlimited: false}});
|
||||
expect(settings.scoring).toStrictEqual({ attempts: { number: 1, unlimited: false } });
|
||||
});
|
||||
|
||||
test('Test score settings missing with null default', () => {
|
||||
const settings = parseSettings(singleSelectWithHints.metadata, {max_attempts: null});
|
||||
expect(settings.scoring).toStrictEqual({attempts: {number: '', unlimited: true}});
|
||||
const settings = parseSettings(singleSelectWithHints.metadata, { max_attempts: null });
|
||||
expect(settings.scoring).toStrictEqual({ attempts: { number: '', unlimited: true } });
|
||||
});
|
||||
|
||||
test('Test invalid randomization', () => {
|
||||
|
||||
Reference in New Issue
Block a user