28 lines
686 B
TypeScript
28 lines
686 B
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import test from "node:test";
|
|
|
|
const runsSource = readFileSync(
|
|
join(process.cwd(), "convex", "runs.ts"),
|
|
"utf8",
|
|
);
|
|
const schemaSource = readFileSync(
|
|
join(process.cwd(), "convex", "schema.ts"),
|
|
"utf8",
|
|
);
|
|
|
|
test("run listing supports type-only filtering", () => {
|
|
assert.match(
|
|
runsSource,
|
|
/if\s*\(\s*args\.type\s*\)\s*\{[\s\S]*?\.withIndex\(\s*"by_type"\s*,\s*\(q\)\s*=>\s*q\.eq\("type",\s*type\)\)/,
|
|
);
|
|
});
|
|
|
|
test("agentRuns schema defines by_type index", () => {
|
|
assert.match(
|
|
schemaSource,
|
|
/\.index\("by_type",\s*\["type"\]\)/,
|
|
);
|
|
});
|