Skip to content

Commit 6cd2159

Browse files
committed
test(query): tighten #1026 query key getter assertion
1 parent 33c650b commit 6cd2159

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tests/api-generation.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,11 @@ test('vue-query issue-1026 keeps header params out of the query key getter', asy
198198
expect(end, `${marker} body should be terminated`).toBeGreaterThan(start);
199199
const queryKeyFn = content.slice(start, end);
200200

201-
// The getter must not reference `headers` at all - it is neither a parameter
202-
// nor a query-key segment here.
203-
expect(queryKeyFn).not.toContain('headers');
201+
// The getter must not reference `headers` as an identifier: that was the
202+
// #1026 bug (`headers = unref(headers);`) and unref-ing a param would also
203+
// break query-key reactivity. A word-boundary regex keeps the intent precise
204+
// rather than matching `headers` as a loose substring.
205+
expect(queryKeyFn).not.toMatch(/\bheaders\b/);
204206

205207
// Sanity check: the HTTP function still receives and unrefs `headers`, so the
206208
// assertion above is not passing simply because headers support is missing.

0 commit comments

Comments
 (0)