test: add coverage for unknownSlots graceful degradation

This commit is contained in:
c0dev0id
2026-07-06 21:08:40 +02:00
parent 41b17d4bb0
commit 1ad4b73c9a

View File

@@ -666,6 +666,20 @@ ok('adjacent: null when absent', adjOffset.stemNotes[0].adjacent === null);
ok('adjacent: false when False', adjOffset.stemNotes[1].adjacent === false);
ok('adjacent: true when True', adjOffset.stemNotes[2].adjacent === true);
section('unknownSlots graceful degradation');
const UNK_FIXTURE = `00 instrument 'test'
01 character.FUTURE_SLOT foo='bar'
01 character.variation
02 variation.ANOTHER_UNKNOWN x=1
`;
const unkModel = buildModel(parseAstLog(UNK_FIXTURE));
const unkInstr = unkModel.instruments[0];
ok('unknown slot: instrument parsed', !!unkInstr);
ok('unknown slot: rawChildren is array', Array.isArray(unkInstr.rawChildren));
ok('unknown slot: instrument-level unknown collected', unkInstr.rawChildren.length === 1);
ok('unknown slot: collected slot type', unkInstr.rawChildren[0].type === 'FUTURE_SLOT');
ok('variation-level unknown collected', unkInstr.variations[0]?.rawChildren?.length === 1);
section('Full fixture integration');
ok('fixture parses without error (checked above)', raw && raw.slot === 'root');
ok('fixture has 432 bars', model.bars.length === 432);