From f7564e055362171901c731d96080fe84fdf87c19 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sun, 25 Oct 2026 14:31:52 +0100 Subject: [PATCH] fixed preset test --- extension/test/presets.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extension/test/presets.test.ts b/extension/test/presets.test.ts index 30fffd78..d8837317 100644 --- a/extension/test/presets.test.ts +++ b/extension/test/presets.test.ts @@ -48,7 +48,12 @@ describe('copying a preset', function () { it('finds a preset with or without its extension, and says when that is ambiguous', function () { assert.equal(findTemplate(index, 'nes/aputest.c').template.id, 'aputest.c'); assert.equal(findTemplate(index, 'NES/Aputest').template.id, 'aputest.c'); - assert.throws(() => findTemplate(index, 'nes/hello'), /matches 3 presets/); + // nes/hello names several presets (hello.c, hello.bas, ...): list them all + var hello = index.platforms.find((p) => p.id === 'nes')!.templates + .map((t) => t.id).filter((id) => id.replace(/\.[^./]+$/, '').toLowerCase() === 'hello'); + assert.ok(hello.length > 1, 'nes/hello should be ambiguous'); + assert.throws(() => findTemplate(index, 'nes/hello'), (err: Error) => + err.message === `'nes/hello' matches ${hello.length} presets (${hello.join(', ')}); give the extension.`); assert.throws(() => findTemplate(index, 'nes/nope'), /No preset 'nope'/); assert.throws(() => findTemplate(index, 'nope/hello.c'), /No platform/); assert.throws(() => findTemplate(index, 'hello.c'), /\//);