Refactor code structure for improved readability and maintainability
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s
This commit is contained in:
20
backend/tests/predefinedActivityDrawingData.test.js
Normal file
20
backend/tests/predefinedActivityDrawingData.test.js
Normal 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"}');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user