From b3eb9d018b020a8929c6fbed20ee6ab4719d22fa Mon Sep 17 00:00:00 2001 From: Void Date: Mon, 9 Nov 2026 10:48:28 +0000 Subject: [PATCH] dings tests: pin the path guard, prototype names, pick volume, array senders Soul's surviving mutants: dropped dot-segment guard, hasOwnProperty dropped in readClips, pickDing volume constant, isRecord without the array check. The `in` + `{}` pair is equivalent (a prototype name resolves to a non-clip, so neutral applies either way). Co-Authored-By: Claude Sonnet 5.5 --- src/app/features/dings/dings.test.ts | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/app/features/dings/dings.test.ts b/src/app/features/dings/dings.test.ts index a8dcde40..d5c5e601 100644 --- a/src/app/features/dings/dings.test.ts +++ b/src/app/features/dings/dings.test.ts @@ -23,6 +23,38 @@ describe('dings manifest', () => { }); }); +describe('manifest guards', () => { + it('rejects a dot segment in the middle of a path', () => { + const m = parseManifest({ + neutral: { message: 'a/../b.ogg', mention: 'a/b.ogg' }, + senders: {}, + })!; + expect(m.neutral).toEqual({ mention: 'a/b.ogg' }); + }); + + it('is not fooled by an array of senders', () => { + expect(parseManifest({ neutral: { message: 'a.ogg' }, senders: [] })).toBeUndefined(); + }); + + it('ignores motifs a clip set only inherits', () => { + const inherited = Object.create({ message: 'x/message.ogg' }); + const m = parseManifest({ neutral: inherited, senders: {} })!; + expect(m.neutral).toEqual({}); + }); + + it('gives object-prototype names no clip of their own', () => { + const m = parseManifest({ neutral: { message: 'n/message.ogg' }, senders: {} })!; + ['__proto__', 'constructor', 'toString', 'hasOwnProperty'].forEach((who) => { + expect(pickDing(m, who, 'message')?.path).toBe('n/message.ogg'); + }); + }); + + it('reports the motif volume in the pick itself', () => { + expect(pickDing(manifest, 'eureka', 'message')?.volume).toBe(DING_VOLUME.message); + expect(pickDing(manifest, 'stranger', 'mention')?.volume).toBe(1); + }); +}); + describe('which ding plays', () => { it('uses the sender instrument for the motif', () => { expect(pickDing(manifest, 'eureka', 'mention')).toEqual({