test: alert mobile team if challenge schema changes (#65860)

This commit is contained in:
Oliver Eyton-Williams
2026-02-13 07:58:04 +01:00
committed by GitHub
parent 67eff731c2
commit 055ba37e54
3 changed files with 2324 additions and 11 deletions
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -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();
});
});