mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
test: alert mobile team if challenge schema changes (#65860)
This commit is contained in:
committed by
GitHub
parent
67eff731c2
commit
055ba37e54
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,20 @@
|
||||
const Joi = require('joi');
|
||||
Joi.objectId = require('joi-objectid')(Joi);
|
||||
import Joi from 'joi';
|
||||
import joiObjectId from 'joi-objectid';
|
||||
|
||||
const {
|
||||
challengeTypes
|
||||
} = require('@freecodecamp/shared/config/challenge-types');
|
||||
const {
|
||||
Joi.objectId = joiObjectId(Joi);
|
||||
|
||||
import { challengeTypes } from '@freecodecamp/shared/config/challenge-types';
|
||||
import {
|
||||
chapterBasedSuperBlocks,
|
||||
languageSuperBlocks,
|
||||
SuperBlocks
|
||||
} = require('@freecodecamp/shared/config/curriculum');
|
||||
const {
|
||||
} from '@freecodecamp/shared/config/curriculum';
|
||||
import {
|
||||
availableCharacters,
|
||||
availableBackgrounds,
|
||||
availableAudios,
|
||||
availableAlignments
|
||||
} = require('./scene-assets');
|
||||
} from './scene-assets.js';
|
||||
|
||||
const slugRE = new RegExp('^[a-z0-9-]+$');
|
||||
const slugWithSlashRE = new RegExp('^[a-z0-9-/]+$');
|
||||
@@ -143,7 +143,7 @@ const quizJoi = Joi.object().keys({
|
||||
.required()
|
||||
});
|
||||
|
||||
const schema = Joi.object().keys({
|
||||
export const schema = Joi.object().keys({
|
||||
block: Joi.string().regex(slugRE).required(),
|
||||
blockId: Joi.objectId(),
|
||||
blockLabel: Joi.when('superBlock', {
|
||||
@@ -395,6 +395,6 @@ const schema = Joi.object().keys({
|
||||
usesMultifileEditor: Joi.boolean()
|
||||
});
|
||||
|
||||
exports.challengeSchemaValidator = () => {
|
||||
export const challengeSchemaValidator = () => {
|
||||
return challenge => schema.validate(challenge);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { schema } from './challenge-schema.js';
|
||||
|
||||
describe('challenge schema', () => {
|
||||
it('should not be changed without informing the mobile team', () => {
|
||||
expect(schema.describe()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user