Files

24 lines
854 B
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { parseOverlayLibrary } from '../src/utils/overlayConfig.ts'
test('parseOverlayLibrary accepts simple local raster files', () => {
assert.deepEqual(
parseOverlayLibrary([{ id: 'crr', name: ' CRR Logo ', file: 'crr-logo.png' }]),
[{ id: 'crr', name: 'CRR Logo', file: 'crr-logo.png' }],
)
})
test('parseOverlayLibrary rejects duplicate ids', () => {
assert.throws(() => parseOverlayLibrary([
{ id: 'crr', name: 'One', file: 'one.png' },
{ id: 'crr', name: 'Two', file: 'two.png' },
]))
})
test('parseOverlayLibrary rejects paths, URLs, and SVG files', () => {
for (const file of ['../logo.png', 'nested/logo.png', 'https://example.test/logo.png', 'logo.svg']) {
assert.throws(() => parseOverlayLibrary([{ id: 'bad', name: 'Bad', file }]))
}
})