mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-20 12:03:11 -04:00
refactor(client): remove hasNoTests by challenge type (#54494)
Co-authored-by: Naomi <nhcarrigan@gmail.com>
This commit is contained in:
@@ -17,7 +17,6 @@ import {
|
||||
} from '../../../utils/error-messages';
|
||||
import {
|
||||
challengeTypes,
|
||||
hasNoTests,
|
||||
submitTypes
|
||||
} from '../../../../../shared/config/challenge-types';
|
||||
import { actionTypes as submitActionTypes } from '../../../redux/action-types';
|
||||
@@ -100,10 +99,7 @@ function postChallenge(update, username) {
|
||||
function submitModern(type, state) {
|
||||
const challengeType = state.challenge.challengeMeta.challengeType;
|
||||
const tests = challengeTestsSelector(state);
|
||||
if (
|
||||
hasNoTests(challengeType) ||
|
||||
(tests.length > 0 && tests.every(test => test.pass && !test.err))
|
||||
) {
|
||||
if (tests.length === 0 || tests.every(test => test.pass && !test.err)) {
|
||||
if (type === actionTypes.checkChallenge) {
|
||||
return of({ type: 'this was a check challenge' });
|
||||
}
|
||||
|
||||
@@ -202,19 +202,21 @@ const schema = Joi.object()
|
||||
superBlock: Joi.string().regex(slugWithSlashRE),
|
||||
superOrder: Joi.number(),
|
||||
suborder: Joi.number(),
|
||||
tests: Joi.array().items(
|
||||
// public challenges
|
||||
Joi.object().keys({
|
||||
id: Joi.string().allow(''),
|
||||
text: Joi.string().required(),
|
||||
testString: Joi.string().allow('').required()
|
||||
}),
|
||||
// our tests used in certification verification
|
||||
Joi.object().keys({
|
||||
id: Joi.string().required(),
|
||||
title: Joi.string().required()
|
||||
})
|
||||
),
|
||||
tests: Joi.array()
|
||||
.items(
|
||||
// public challenges
|
||||
Joi.object().keys({
|
||||
id: Joi.string().allow(''),
|
||||
text: Joi.string().required(),
|
||||
testString: Joi.string().allow('').required()
|
||||
}),
|
||||
// our tests used in certification verification
|
||||
Joi.object().keys({
|
||||
id: Joi.string().required(),
|
||||
title: Joi.string().required()
|
||||
})
|
||||
)
|
||||
.required(),
|
||||
template: Joi.string().allow(''),
|
||||
time: Joi.string().allow(''),
|
||||
title: Joi.string().required(),
|
||||
|
||||
@@ -199,19 +199,21 @@ const schema = Joi.object()
|
||||
superBlock: Joi.string().regex(slugWithSlashRE),
|
||||
superOrder: Joi.number(),
|
||||
suborder: Joi.number(),
|
||||
tests: Joi.array().items(
|
||||
// public challenges
|
||||
Joi.object().keys({
|
||||
id: Joi.string().allow(''),
|
||||
text: Joi.string().required(),
|
||||
testString: Joi.string().allow('').required()
|
||||
}),
|
||||
// our tests used in certification verification
|
||||
Joi.object().keys({
|
||||
id: Joi.string().required(),
|
||||
title: Joi.string().required()
|
||||
})
|
||||
),
|
||||
tests: Joi.array()
|
||||
.items(
|
||||
// public challenges
|
||||
Joi.object().keys({
|
||||
id: Joi.string().allow(''),
|
||||
text: Joi.string().required(),
|
||||
testString: Joi.string().allow('').required()
|
||||
}),
|
||||
// our tests used in certification verification
|
||||
Joi.object().keys({
|
||||
id: Joi.string().required(),
|
||||
title: Joi.string().required()
|
||||
})
|
||||
)
|
||||
.required(),
|
||||
template: Joi.string().allow(''),
|
||||
time: Joi.string().allow(''),
|
||||
title: Joi.string().required(),
|
||||
|
||||
@@ -52,13 +52,6 @@ export const challengeTypes = {
|
||||
multifilePythonCertProject
|
||||
};
|
||||
|
||||
export const hasNoTests = (challengeType: number): boolean =>
|
||||
challengeType === multipleChoice ||
|
||||
challengeType === theOdinProject ||
|
||||
challengeType === video ||
|
||||
challengeType === dialogue ||
|
||||
challengeType === fillInTheBlank;
|
||||
|
||||
export const hasNoSolution = (challengeType: number): boolean => {
|
||||
const noSolutions = [
|
||||
backend,
|
||||
|
||||
Reference in New Issue
Block a user