Skip to content

Commit afd1036

Browse files
committed
test(agent-context): drift gate also validates template.* subtypes
1 parent f513891 commit afd1036

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

server/typescript/packages/sdk/test/agent-context/drift.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { test, expect, describe } from "bun:test";
33
import { readFileSync, readdirSync, statSync } from "node:fs";
44
import { join } from "node:path";
5-
import { FIELD_SUBTYPES, OBJECT_SUBTYPES, SOURCE_SUBTYPES } from "@metaobjectsdev/metadata";
5+
import { FIELD_SUBTYPES, OBJECT_SUBTYPES, SOURCE_SUBTYPES, TEMPLATE_SUBTYPES } from "@metaobjectsdev/metadata";
66

77
const CONTENT_ROOT = join(import.meta.dir, "../../../../../../agent-context");
88

@@ -43,13 +43,15 @@ describe("agent-context vocabulary drift", () => {
4343
expect(bad).toEqual([]);
4444
});
4545

46-
test("every `object.<subtype>` and `source.<subtype>` mentioned is real", () => {
46+
test("every `object.`, `source.`, and `template.` subtype mentioned is real", () => {
4747
const objs = new Set<string>(OBJECT_SUBTYPES as readonly string[]);
4848
const srcs = new Set<string>(SOURCE_SUBTYPES as readonly string[]);
49+
const tmpls = new Set<string>(TEMPLATE_SUBTYPES as readonly string[]);
4950
const bad: string[] = [];
5051
for (const { f, text } of corpus) {
5152
for (const m of text.matchAll(/\bobject\.([a-z][a-zA-Z0-9]*)\b/g)) if (!objs.has(m[1]!)) bad.push(`${f} :: object.${m[1]}`);
5253
for (const m of text.matchAll(/\bsource\.([a-z][a-zA-Z0-9]*)\b/g)) if (!srcs.has(m[1]!)) bad.push(`${f} :: source.${m[1]}`);
54+
for (const m of text.matchAll(/\btemplate\.([a-z][a-zA-Z0-9]*)\b/g)) if (!tmpls.has(m[1]!)) bad.push(`${f} :: template.${m[1]}`);
5355
}
5456
expect(bad).toEqual([]);
5557
});

0 commit comments

Comments
 (0)