This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
breakpilot-pwa/h5p-service/tests/server.test.js
Benjamin Admin bfdaf63ba9 fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.

This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).

Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:51:32 +01:00

237 lines
8.0 KiB
JavaScript

/**
* H5P Service Integration Tests (ESM)
* Tests für alle H5P Service Endpoints
*/
import request from 'supertest';
import { describe, test, expect } from '@jest/globals';
import { app } from '../server-simple.js';
describe('H5P Service - Health & Info', () => {
test('GET / should return service info page', async () => {
const response = await request(app).get('/');
expect(response.status).toBe(200);
expect(response.text).toContain('H5P Service');
expect(response.text).toContain('Running');
});
test('GET /health should return healthy status', async () => {
const response = await request(app).get('/health');
expect(response.status).toBe(200);
expect(response.body).toMatchObject({
status: 'healthy',
service: 'h5p-service-simplified'
});
});
});
describe('H5P Service - Editor Selection Page', () => {
test('GET /h5p/editor/new should return editor selection page', async () => {
const response = await request(app).get('/h5p/editor/new');
expect(response.status).toBe(200);
expect(response.text).toContain('H5P Content Creator');
expect(response.text).toContain('Quiz');
expect(response.text).toContain('Interactive Video');
expect(response.text).toContain('Course Presentation');
expect(response.text).toContain('Flashcards');
expect(response.text).toContain('Timeline');
expect(response.text).toContain('Drag and Drop');
expect(response.text).toContain('Fill in the Blanks');
expect(response.text).toContain('Memory Game');
});
test('Editor page should contain all 8 content types', async () => {
const response = await request(app).get('/h5p/editor/new');
const contentTypes = [
'Quiz',
'Interactive Video',
'Course Presentation',
'Flashcards',
'Timeline',
'Drag and Drop',
'Fill in the Blanks',
'Memory Game'
];
contentTypes.forEach(type => {
expect(response.text).toContain(type);
});
});
});
describe('H5P Service - Quiz Editor & Player', () => {
test('GET /h5p/editor/quiz should return quiz editor', async () => {
const response = await request(app).get('/h5p/editor/quiz');
expect(response.status).toBe(200);
expect(response.text).toContain('Quiz Editor');
expect(response.text).toContain('Frage hinzufügen');
});
test('GET /h5p/player/quiz should return quiz player', async () => {
const response = await request(app).get('/h5p/player/quiz');
expect(response.status).toBe(200);
expect(response.text).toContain('Quiz');
});
});
describe('H5P Service - Interactive Video Editor & Player', () => {
test('GET /h5p/editor/interactive-video should return video editor', async () => {
const response = await request(app).get('/h5p/editor/interactive-video');
expect(response.status).toBe(200);
expect(response.text).toContain('Interactive Video Editor');
expect(response.text).toContain('Video-URL');
});
test('GET /h5p/player/interactive-video should return video player', async () => {
const response = await request(app).get('/h5p/player/interactive-video');
expect(response.status).toBe(200);
expect(response.text).toContain('Interactive Video');
});
});
describe('H5P Service - Course Presentation Editor & Player', () => {
test('GET /h5p/editor/course-presentation should return presentation editor', async () => {
const response = await request(app).get('/h5p/editor/course-presentation');
expect(response.status).toBe(200);
expect(response.text).toContain('Course Presentation Editor');
expect(response.text).toContain('Folien');
});
test('GET /h5p/player/course-presentation should return presentation player', async () => {
const response = await request(app).get('/h5p/player/course-presentation');
expect(response.status).toBe(200);
expect(response.text).toContain('Course Presentation');
});
});
describe('H5P Service - Flashcards Editor', () => {
test('GET /h5p/editor/flashcards should return flashcards editor', async () => {
const response = await request(app).get('/h5p/editor/flashcards');
expect(response.status).toBe(200);
expect(response.text).toContain('Flashcards Editor');
expect(response.text).toContain('Karte hinzufügen');
});
});
describe('H5P Service - Timeline Editor & Player', () => {
test('GET /h5p/editor/timeline should return timeline editor', async () => {
const response = await request(app).get('/h5p/editor/timeline');
expect(response.status).toBe(200);
expect(response.text).toContain('Timeline Editor');
expect(response.text).toContain('Ereignis');
});
test('GET /h5p/player/timeline should return timeline player', async () => {
const response = await request(app).get('/h5p/player/timeline');
expect(response.status).toBe(200);
expect(response.text).toContain('Timeline');
});
});
describe('H5P Service - Drag and Drop Editor & Player', () => {
test('GET /h5p/editor/drag-drop should return drag drop editor', async () => {
const response = await request(app).get('/h5p/editor/drag-drop');
expect(response.status).toBe(200);
expect(response.text).toContain('Drag and Drop Editor');
expect(response.text).toContain('Drop Zones');
});
test('GET /h5p/player/drag-drop should return drag drop player', async () => {
const response = await request(app).get('/h5p/player/drag-drop');
expect(response.status).toBe(200);
expect(response.text).toContain('Drag and Drop');
});
});
describe('H5P Service - Fill in the Blanks Editor & Player', () => {
test('GET /h5p/editor/fill-blanks should return fill blanks editor', async () => {
const response = await request(app).get('/h5p/editor/fill-blanks');
expect(response.status).toBe(200);
expect(response.text).toContain('Fill in the Blanks Editor');
expect(response.text).toContain('Lückentext');
});
test('GET /h5p/player/fill-blanks should return fill blanks player', async () => {
const response = await request(app).get('/h5p/player/fill-blanks');
expect(response.status).toBe(200);
expect(response.text).toContain('Fill in the Blanks');
});
});
describe('H5P Service - Memory Game Editor & Player', () => {
test('GET /h5p/editor/memory should return memory editor', async () => {
const response = await request(app).get('/h5p/editor/memory');
expect(response.status).toBe(200);
expect(response.text).toContain('Memory Game Editor');
expect(response.text).toContain('Paar');
});
test('GET /h5p/player/memory should return memory player', async () => {
const response = await request(app).get('/h5p/player/memory');
expect(response.status).toBe(200);
expect(response.text).toContain('Memory');
});
});
describe('H5P Service - Static Files', () => {
test('Static core files should be accessible', async () => {
const response = await request(app).get('/h5p/core/h5p.css');
// May or may not exist, but should not 500
expect([200, 404]).toContain(response.status);
});
test('Editors directory should be accessible', async () => {
const response = await request(app).get('/h5p/editors/quiz-editor.html');
expect(response.status).toBe(200);
expect(response.text).toContain('Quiz Editor');
});
test('Players directory should be accessible', async () => {
const response = await request(app).get('/h5p/players/quiz-player.html');
expect(response.status).toBe(200);
expect(response.text).toContain('Quiz');
});
});
describe('H5P Service - Error Handling', () => {
test('GET /nonexistent should return 404', async () => {
const response = await request(app).get('/nonexistent');
expect(response.status).toBe(404);
});
test('Invalid editor route should return 404', async () => {
const response = await request(app).get('/h5p/editor/nonexistent');
expect(response.status).toBe(404);
});
test('Invalid player route should return 404', async () => {
const response = await request(app).get('/h5p/player/nonexistent');
expect(response.status).toBe(404);
});
});