Refactor code structure for improved readability and maintainability
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s

This commit is contained in:
Torsten Schulz (local)
2026-05-27 23:53:41 +02:00
parent 2e7cf0c28d
commit e57cdc6ad8
25 changed files with 156689 additions and 171 deletions

View File

@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { normalizeStoredDrawingData } from '../utils/drawingData.js';
describe('predefined activity drawing data', () => {
it('stores drawing objects as JSON once', () => {
expect(normalizeStoredDrawingData({ selectedStartPosition: 'AS1' }))
.toBe('{"selectedStartPosition":"AS1"}');
});
it('does not double encode JSON text sent by mobile clients', () => {
expect(normalizeStoredDrawingData('{"strokeType":"VH"}'))
.toBe('{"strokeType":"VH"}');
});
it('repairs previously double encoded JSON text', () => {
expect(normalizeStoredDrawingData('"{\\"targetPosition\\":\\"5\\"}"'))
.toBe('{"targetPosition":"5"}');
});
});