dings tests: pin the path guard, prototype names, pick volume, array senders
Some checks failed
Build pull request / Build pull request (pull_request) Failing after 3m43s
Some checks failed
Build pull request / Build pull request (pull_request) Failing after 3m43s
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 <noreply@anthropic.com>
This commit is contained in:
parent
8368c6e5c3
commit
b3eb9d018b
1 changed files with 32 additions and 0 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue