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
BreakPilot Dev 19855efacc
Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
feat: BreakPilot PWA - Full codebase (clean push without large binaries)
All services: admin-v2, studio-v2, website, ai-compliance-sdk,
consent-service, klausur-service, voice-service, and infrastructure.
Large PDFs and compiled binaries excluded via .gitignore.
2026-02-11 13:25:58 +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);
});
});