test: add coverage for unknownSlots graceful degradation
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user