|
2 | 2 | import { test, expect, describe } from "bun:test"; |
3 | 3 | import { readFileSync, readdirSync, statSync } from "node:fs"; |
4 | 4 | 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"; |
6 | 6 |
|
7 | 7 | const CONTENT_ROOT = join(import.meta.dir, "../../../../../../agent-context"); |
8 | 8 |
|
@@ -43,13 +43,15 @@ describe("agent-context vocabulary drift", () => { |
43 | 43 | expect(bad).toEqual([]); |
44 | 44 | }); |
45 | 45 |
|
46 | | - test("every `object.<subtype>` and `source.<subtype>` mentioned is real", () => { |
| 46 | + test("every `object.`, `source.`, and `template.` subtype mentioned is real", () => { |
47 | 47 | const objs = new Set<string>(OBJECT_SUBTYPES as readonly string[]); |
48 | 48 | const srcs = new Set<string>(SOURCE_SUBTYPES as readonly string[]); |
| 49 | + const tmpls = new Set<string>(TEMPLATE_SUBTYPES as readonly string[]); |
49 | 50 | const bad: string[] = []; |
50 | 51 | for (const { f, text } of corpus) { |
51 | 52 | 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]}`); |
52 | 53 | 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]}`); |
53 | 55 | } |
54 | 56 | expect(bad).toEqual([]); |
55 | 57 | }); |
|
0 commit comments