visualisierung

This commit is contained in:
marco committed 2026-10-26 07:34:23 +01:00
1 parent d0655f3638
commit 367c93c93e
84 files changed
+2265 -148

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, it } from '@jest/globals';
import { DrawWarnung, parseWarnungRequest } from './drawWarnung';
describe('Warnung ohne MinMax', () => {
it('liefert die Originalgeometrie als SVG, XAML und UTF-8-Base64', () => {
const { config, options } = parseWarnungRequest({ config: {} });
const result = new DrawWarnung().getObject(config, options);
expect(result.width).toBe(20);
expect(result.height).toBe(20);
expect(result.varianten).toHaveLength(1);
const variant = result.varianten[0];
expect(variant.svg).toContain('fill="#FAC44F" fill-rule="evenodd"');
expect(variant.xaml).toContain('FillRule="EvenOdd"');
expect(variant.xaml).toContain('Width="20" Height="20"');
expect(Buffer.from(variant.xamlBase64, 'base64').toString('utf8')).toBe(variant.xaml);
});
it('übernimmt Größe und Farbe', () => {
const { config, options } = parseWarnungRequest({ config: { width: 40, height: 30 }, options: { color: '#FF0000' } });
expect(new DrawWarnung().getObject(config, options).varianten[0].svg).toContain('fill="#FF0000"');
});
it.each([null, {}, { config: { width: -1 } }, { config: {}, options: { color: '<script>' } }])('weist ungültige Parameter zurück', input => {
expect(() => parseWarnungRequest(input)).toThrow();
});
});