Skip to content

Commit ffb9b42

Browse files
committed
test(rest): the /references refusal pin names the missing prescription in its diff
`toContain` on an absent nested message fails with a matcher TYPE complaint rather than with the finding — measured under ablation. `toEqual` + `stringContaining` prints `undefined` against the expected sentence, which is what a reader of a red run needs to see. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D47qPfEWVPmhguWgBZCi5N
1 parent 8bd1b3b commit ffb9b42

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

packages/rest/src/rest-server-meta-references-refusal-envelope.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,23 @@ describe('#15685 the /references door answers its two refusals in ONE envelope',
165165
expect(refused.thrown, `the door threw: ${refused.thrown?.message}`).toBeUndefined();
166166
expect(refused.status).toBe(501);
167167

168+
// `toEqual(stringContaining)` rather than `toContain`, deliberately:
169+
// when the prose is missing this reads `undefined`, and `toContain`
170+
// fails on an `undefined` subject with a matcher TYPE complaint
171+
// rather than with the finding. The diff below names the fact.
168172
const message = refused.body?.error?.message;
169173
// The WHOLE point of the message: what to ask INSTEAD. Anchored on
170174
// the URL it prescribes, derived from the composite key's owner —
171175
// an operator can act on this sentence and on no other.
172-
expect(message).toContain(
173-
`Ask the owning object instead: GET /api/v1/meta/object/account/references`,
174-
);
176+
expect(
177+
message,
178+
'refusal A carried no nested message — the prescription never reached the caller',
179+
).toEqual(expect.stringContaining(
180+
'Ask the owning object instead: GET /api/v1/meta/object/account/references',
181+
));
175182
// And the fact the empty answer would have misreported, spelled out
176183
// rather than left to be inferred from a 501.
177-
expect(message).toContain('cannot be computed');
184+
expect(message).toEqual(expect.stringContaining('cannot be computed'));
178185

179186
// The direct statement of the regression, not merely its absence:
180187
// the generic fault text is what this used to be, everywhere in the

0 commit comments

Comments
 (0)