Skip to content

Commit 7ff2b9e

Browse files
committed
test: the Last-Modified pins pay their lazy first loads at collection, and the where double refuses combinators
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5p9eu5KqN5GP7JZAGe
1 parent a6bb0f1 commit 7ff2b9e

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/metadata-protocol/src/protocol.cached-item-last-modified.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* `lastModified: new Date().toISOString()` back in
2222
* `protocol-search-and-cache.ts` turns §1, §2 and §3 red.
2323
*/
24+
// Pays the lint root's first load at collection, never inside a clocked case.
25+
import './lint-root-preload.testkit.js';
2426
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2527
import {
2628
assertEngineDeleteDispatch,
@@ -39,6 +41,8 @@ const whereValueMatches = (actual: unknown, want: unknown): boolean =>
3941

4042
function matches(r: Row, where: Record<string, unknown> = {}): boolean {
4143
for (const [k, v] of Object.entries(where)) {
44+
// A combinator is refused, never read as a field name.
45+
if (k.startsWith('$')) throw new Error(`matches: unsupported combinator ${k}`);
4246
if (v === undefined) continue;
4347
if (!whereValueMatches(r[k] ?? null, v)) return false;
4448
}

‎packages/rest/src/meta-item-cached-last-modified.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// judged by the ETag alone, so `If-Modified-Since` never answers a `304`, with
1212
// or without a time to compare against.
1313

14+
// Pays `@objectstack/objectql`'s first load at collection, never inside a clocked case
15+
// (the route modules import it lazily).
16+
import '@objectstack/objectql';
1417
import { describe, it, expect, vi } from 'vitest';
1518
import { RestServer } from './rest-server';
1619

0 commit comments

Comments
 (0)