Files
markdown-converter/tests/main/ascii-art.templates.test.js
amitwh bb99a5c5ee feat(ascii-art): 19 named ASCII art templates with snapshot tests
Per Task 3 of the 2026-09-14 ASCII art upgrade plan.

- New module: src/main/AsciiArt.templates.js exporting ASCII_TEMPLATES
  (19 entries) and getTemplate(name) accessor (returns '' for unknown).
- New test: tests/main/ascii-art.templates.test.js with 19 per-template
  snapshots + unknown-name + keys-match assertions (21 tests total).
- 17 templates verbatim from src/ascii-generator.html:596-626
  (arrow-right, arrow-down, decision, process, flowchart, sequence,
  network, hierarchy, header, note, warning, info, divider, separator,
  banner, checklist + the brief's own TEMPLATE_NAMES order).
- 2 templates verbatim from src/renderer.js:6542-6697
  (progress-bar, table-simple).
- 1 newly authored: arrow-up (completes the arrow triplet; does not
  exist in either source).

Amit Haridas
2026-09-14 20:35:39 +05:30

46 lines
999 B
JavaScript

/**
* @jest-environment node
*
* Per-template snapshot tests. Templates are static strings; the snapshot
* catches accidental edits during refactors.
*/
const AsciiArtTemplates = require('../../src/main/AsciiArt.templates');
const TEMPLATE_NAMES = [
'arrow-right',
'arrow-down',
'arrow-up',
'decision',
'process',
'flowchart',
'sequence',
'network',
'hierarchy',
'header',
'note',
'warning',
'info',
'divider',
'separator',
'banner',
'checklist',
'progress-bar',
'table-simple',
];
describe('AsciiArt.templates', () => {
test.each(TEMPLATE_NAMES)('%s', (name) => {
expect(AsciiArtTemplates.getTemplate(name)).toMatchSnapshot();
});
test('returns empty string for unknown name', () => {
expect(AsciiArtTemplates.getTemplate('nope')).toBe('');
});
test('ASCII_TEMPLATES object exposes all 19 names', () => {
expect(Object.keys(AsciiArtTemplates.ASCII_TEMPLATES).sort()).toEqual(
TEMPLATE_NAMES.slice().sort()
);
});
});