- Enhanced Story Reader with text-to-story conversion methods - Added support for simple texts and sentences in Story Reader - Removed Text Reader game file (js/games/text-reader.js) - Updated all configuration files to remove Text Reader references - Modified game compatibility system to use Story Reader instead - Updated test fixtures to reflect game changes - Cleaned up debug/test HTML files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
167 lines
4.2 KiB
JavaScript
167 lines
4.2 KiB
JavaScript
// Fixtures pour les tests - échantillons de contenu
|
|
|
|
export const sampleJSONContent = {
|
|
name: "Test Content JSON",
|
|
description: "Contenu de test au format JSON",
|
|
difficulty: "medium",
|
|
language: "english",
|
|
icon: "🧪",
|
|
vocabulary: {
|
|
"hello": "salut",
|
|
"world": "monde",
|
|
"test": "test",
|
|
"school": "école",
|
|
"book": "livre"
|
|
},
|
|
sentences: [
|
|
{
|
|
english: "Hello world",
|
|
chinese: "你好世界",
|
|
prononciation: "nǐ hǎo shì jiè"
|
|
},
|
|
{
|
|
english: "I go to school",
|
|
chinese: "我去学校",
|
|
prononciation: "wǒ qù xuéxiào"
|
|
}
|
|
],
|
|
grammar: {
|
|
"present_tense": {
|
|
title: "Present Tense",
|
|
explanation: "Used for current actions",
|
|
examples: [
|
|
{ chinese: "我学习", english: "I study", prononciation: "wǒ xuéxí" }
|
|
]
|
|
}
|
|
}
|
|
};
|
|
|
|
export const sampleJSContent = {
|
|
vocabulary: {
|
|
central: "中心的;中央的",
|
|
avenue: "大街;林荫道",
|
|
refrigerator: "冰箱",
|
|
closet: "衣柜;壁橱",
|
|
elevator: "电梯"
|
|
},
|
|
sentences: [
|
|
{
|
|
english: "The building is in the center",
|
|
chinese: "大楼在中心",
|
|
prononciation: "dà lóu zài zhōngxīn"
|
|
}
|
|
]
|
|
};
|
|
|
|
export const gameCompatibilityTestData = [
|
|
{
|
|
content: { vocabulary: { "test": "test" } },
|
|
expectedGames: ["whack-a-mole", "memory-match", "quiz-game"]
|
|
},
|
|
{
|
|
content: {
|
|
vocabulary: { "test": "test" },
|
|
sentences: [{ english: "test", chinese: "test" }]
|
|
},
|
|
expectedGames: ["whack-a-mole", "memory-match", "quiz-game", "fill-the-blank"]
|
|
},
|
|
{
|
|
content: {
|
|
vocabulary: { "test": "test" },
|
|
texts: [{ title: "Test", content: "Test content" }]
|
|
},
|
|
expectedGames: ["whack-a-mole", "memory-match", "quiz-game", "story-reader"]
|
|
}
|
|
];
|
|
|
|
export const invalidContentSamples = [
|
|
{},
|
|
null,
|
|
undefined,
|
|
{ name: "Invalid" }, // pas de vocabulary
|
|
{ vocabulary: {} }, // vocabulary vide
|
|
{ vocabulary: null },
|
|
{ vocabulary: "not an object" }
|
|
];
|
|
|
|
export const networkTestResponses = {
|
|
"http://localhost:8083/do-proxy/sbs-level-7-8-new.json": {
|
|
ok: true,
|
|
data: sampleJSONContent
|
|
},
|
|
"http://localhost:8083/do-proxy/english-class-demo.json": {
|
|
ok: true,
|
|
data: {
|
|
name: "English Class Demo",
|
|
vocabulary: { "demo": "démonstration" }
|
|
}
|
|
},
|
|
"http://localhost:8083/do-proxy/nonexistent.json": {
|
|
ok: false,
|
|
status: 404
|
|
}
|
|
};
|
|
|
|
export const proxyTestCases = [
|
|
{
|
|
name: "Valid JSON file",
|
|
url: "/do-proxy/sbs-level-7-8-new.json",
|
|
expectedStatus: 200,
|
|
expectedContent: sampleJSONContent
|
|
},
|
|
{
|
|
name: "Non-existent file",
|
|
url: "/do-proxy/nonexistent.json",
|
|
expectedStatus: 404
|
|
},
|
|
{
|
|
name: "Invalid path",
|
|
url: "/invalid-path",
|
|
expectedStatus: 404
|
|
}
|
|
];
|
|
|
|
export const moduleNameMappingTests = [
|
|
{
|
|
filename: "sbs-level-7-8-new.json",
|
|
expected: "SBSLevel78New"
|
|
},
|
|
{
|
|
filename: "english-class-demo.json",
|
|
expected: "EnglishClassDemo"
|
|
},
|
|
{
|
|
filename: "test-content.json",
|
|
expected: "TestContent"
|
|
},
|
|
{
|
|
filename: "simple.json",
|
|
expected: "Simple"
|
|
}
|
|
];
|
|
|
|
export const contentScannerTestData = {
|
|
localFiles: ["sbs-level-7-8-new.js"],
|
|
remoteFiles: ["sbs-level-7-8-new.json", "english-class-demo.json"],
|
|
expectedModules: ["SBSLevel78New", "EnglishClassDemo"]
|
|
};
|
|
|
|
export const gameTestData = {
|
|
whackAMole: {
|
|
vocabulary: { "cat": "chat", "dog": "chien", "bird": "oiseau" },
|
|
minWords: 3
|
|
},
|
|
memoryMatch: {
|
|
vocabulary: { "red": "rouge", "blue": "bleu", "green": "vert", "yellow": "jaune" },
|
|
minPairs: 4
|
|
},
|
|
fillTheBlank: {
|
|
sentences: [
|
|
{
|
|
english: "I _____ to school",
|
|
correct: "go",
|
|
options: ["go", "goes", "going", "went"]
|
|
}
|
|
]
|
|
}
|
|
}; |