/** * @jest-environment node */ const { shapeSvg, SHAPE_KINDS, DEFAULT_WIDTH, DEFAULT_HEIGHT, } = require('../src/flowchart/flowchart-shapes'); describe('flowchart-shapes: shapeSvg', () => { test('process emits a at the given coordinates', () => { const svg = shapeSvg('process', 10, 20, 100, 50); expect(svg).toMatch(/ diamond', () => { const svg = shapeSvg('decision', 0, 0, 100, 60); expect(svg).toMatch(/ with rx (stadium)', () => { const svg = shapeSvg('terminator', 0, 0, 120, 40); expect(svg).toMatch(/ { expect(() => shapeSvg('hexagon', 0, 0, 100, 50)).toThrow(/hexagon/); }); test('SHAPE_KINDS lists all 5 shapes', () => { expect(SHAPE_KINDS.sort()).toEqual([ 'decision', 'document', 'process', 'subroutine', 'terminator', ]); }); test('DEFAULT_WIDTH and DEFAULT_HEIGHT are positive numbers', () => { expect(DEFAULT_WIDTH).toBeGreaterThan(0); expect(DEFAULT_HEIGHT).toBeGreaterThan(0); }); });