test(e2e): cover the flag-outranks-sequence rule in the cassette matcher

Deleting `eligible`'s second line — the one that makes a newly-enabled flagged
entry outrank the unflagged candidates — left the whole unit tier green. The
existing cases use two entries, where the consumed-index cursor lands on the
flagged entry anyway, so sequencing alone reproduced every asserted progression.

Add a three-candidate case where the two disagree: it passes as written and
fails with that line removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-24 19:04:48 +07:00
co-authored by Claude Opus 4.8
parent 9d4f5912f4
commit 0a8ca104e0
+20
View File
@@ -67,6 +67,26 @@ describe('MockWorld matching', () => {
expect(world.matchGraphQL('info', {})?.data).toEqual({ role: 'user' });
});
it('prefers the newly-enabled entry over the next unserved one, not merely the next in order', () => {
// Three candidates, so sequencing and the flag rule disagree: with the rule the raised flag
// jumps straight to `flagged`; without it the cursor would just hand out `second`. The
// two-entry cases above cannot tell the two apart.
const world = new MockWorld({
mutations: { go: [{ data: {}, setFlag: 'go' }] },
queries: {
stage: [
{ data: { stage: 'first' } },
{ data: { stage: 'second' } },
{ data: { stage: 'flagged' }, whenFlag: 'go' },
],
},
});
expect(world.matchGraphQL('stage', {})?.data).toEqual({ stage: 'first' });
world.matchGraphQL('go', {});
expect(world.matchGraphQL('stage', {})?.data).toEqual({ stage: 'flagged' });
});
it('advances to the newly-enabled entry after a second flag, without replaying the first', () => {
const world = new MockWorld({
mutations: { f1: [{ data: {}, setFlag: 'f1' }], f2: [{ data: {}, setFlag: 'f2' }] },