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>
This commit is contained in:
170
h5p-service/tests/README.md
Normal file
170
h5p-service/tests/README.md
Normal file
@@ -0,0 +1,170 @@
|
||||
# H5P Service Tests
|
||||
|
||||
## Overview
|
||||
|
||||
Dieser Ordner enthält Integration Tests für den BreakPilot H5P Service.
|
||||
|
||||
## Test-Struktur
|
||||
|
||||
```
|
||||
tests/
|
||||
├── README.md # Diese Datei
|
||||
├── setup.js # Jest Test Setup
|
||||
└── server.test.js # Integration Tests für Server Endpoints
|
||||
```
|
||||
|
||||
## Test-Coverage
|
||||
|
||||
Die Tests decken folgende Bereiche ab:
|
||||
|
||||
### 1. Health & Info Endpoints
|
||||
- `GET /` - Service Info Page
|
||||
- `GET /health` - Health Check
|
||||
|
||||
### 2. Editor Selection Page
|
||||
- `GET /h5p/editor/new` - Hauptseite mit allen 8 Content-Typen
|
||||
|
||||
### 3. Content Type Editors (8 Typen)
|
||||
- Quiz Editor
|
||||
- Interactive Video Editor
|
||||
- Course Presentation Editor
|
||||
- Flashcards Editor
|
||||
- Timeline Editor
|
||||
- Drag and Drop Editor
|
||||
- Fill in the Blanks Editor
|
||||
- Memory Game Editor
|
||||
|
||||
### 4. Content Type Players (8 Typen)
|
||||
- Quiz Player
|
||||
- Interactive Video Player
|
||||
- Course Presentation Player
|
||||
- Flashcards Player (coming soon)
|
||||
- Timeline Player
|
||||
- Drag and Drop Player
|
||||
- Fill in the Blanks Player
|
||||
- Memory Game Player
|
||||
|
||||
### 5. Static File Serving
|
||||
- `/h5p/core/*` - H5P Core Files
|
||||
- `/h5p/editors/*` - Editor HTML Files
|
||||
- `/h5p/players/*` - Player HTML Files
|
||||
|
||||
### 6. Error Handling
|
||||
- 404 für nicht existierende Routes
|
||||
- Invalid Editor/Player Routes
|
||||
|
||||
## Tests ausführen
|
||||
|
||||
### Lokale Entwicklung
|
||||
|
||||
```bash
|
||||
# Alle Tests ausführen
|
||||
npm test
|
||||
|
||||
# Tests mit Watch-Mode
|
||||
npm run test:watch
|
||||
|
||||
# Tests für CI/CD
|
||||
npm run test:ci
|
||||
```
|
||||
|
||||
### Docker Container Tests
|
||||
|
||||
```bash
|
||||
# Service starten
|
||||
docker compose -f docker-compose.content.yml up -d h5p-service
|
||||
|
||||
# Tests im Container ausführen
|
||||
docker compose -f docker-compose.content.yml exec h5p-service npm test
|
||||
```
|
||||
|
||||
## Test-Konfiguration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Default | Beschreibung |
|
||||
|----------|---------|--------------|
|
||||
| `H5P_TEST_URL` | `http://localhost:8080` | Base URL für Tests |
|
||||
|
||||
### Jest Konfiguration
|
||||
|
||||
Siehe `jest.config.js` für Details:
|
||||
- Test Timeout: 10000ms
|
||||
- Coverage Reports: text, lcov, html
|
||||
- Test Match: `**/tests/**/*.test.js`
|
||||
|
||||
## Coverage
|
||||
|
||||
Coverage Reports werden generiert in:
|
||||
- `coverage/lcov-report/index.html` (HTML Report)
|
||||
- `coverage/lcov.info` (LCOV Format)
|
||||
- Terminal Output
|
||||
|
||||
Ziel: >80% Coverage
|
||||
|
||||
## Neue Tests hinzufügen
|
||||
|
||||
### Test-Template
|
||||
|
||||
```javascript
|
||||
describe('Feature Name', () => {
|
||||
test('should do something', async () => {
|
||||
const response = await request(BASE_URL).get('/endpoint');
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.text).toContain('Expected Content');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Service nicht erreichbar
|
||||
|
||||
```bash
|
||||
# Service Status prüfen
|
||||
docker compose -f docker-compose.content.yml ps
|
||||
|
||||
# Logs ansehen
|
||||
docker compose -f docker-compose.content.yml logs h5p-service
|
||||
|
||||
# Service neu starten
|
||||
docker compose -f docker-compose.content.yml restart h5p-service
|
||||
```
|
||||
|
||||
### Tests schlagen fehl
|
||||
|
||||
1. Prüfe, ob Service läuft: `curl http://localhost:8003/health`
|
||||
2. Prüfe Logs: `docker compose -f docker-compose.content.yml logs h5p-service`
|
||||
3. Rebuilde Container: `docker compose -f docker-compose.content.yml up -d --build h5p-service`
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Isolierte Tests**: Jeder Test sollte unabhängig laufen
|
||||
2. **Cleanup**: Tests sollten keine persistenten Änderungen hinterlassen
|
||||
3. **Assertions**: Klare und aussagekräftige Expectations
|
||||
4. **Beschreibungen**: Aussagekräftige test/describe Namen
|
||||
5. **Speed**: Integration Tests sollten <10s dauern
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
Die Tests werden automatisch ausgeführt bei:
|
||||
- Pull Requests
|
||||
- Commits auf `main` branch
|
||||
- Release Builds
|
||||
|
||||
GitHub Actions Workflow:
|
||||
```yaml
|
||||
- name: Run H5P Service Tests
|
||||
run: |
|
||||
docker compose -f docker-compose.content.yml up -d h5p-service
|
||||
docker compose -f docker-compose.content.yml exec h5p-service npm run test:ci
|
||||
```
|
||||
|
||||
## Zukünftige Erweiterungen
|
||||
|
||||
- [ ] E2E Tests mit Playwright
|
||||
- [ ] Performance Tests
|
||||
- [ ] Content Validation Tests
|
||||
- [ ] Security Tests (XSS, CSRF)
|
||||
- [ ] Load Tests
|
||||
Reference in New Issue
Block a user