Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(links): load bundled packs through the runtime asset path; lower the source-read ratchet

garrytan49869f67668a
diff --git a/test/link-inference-pack.test.ts b/test/link-inference-pack.test.ts
index b529835ab2..71196dc230 100644
--- a/test/link-inference-pack.test.ts
+++ b/test/link-inference-pack.test.ts
@@ -141,14 +141,16 @@ import { readFileSync } from 'node:fs';
import { parseYamlMini } from '../src/core/schema-pack/index.ts';
import { inferNerLinkType } from '../src/core/extract-ner.ts';
import { extractPageLinks } from '../src/core/link-extraction.ts';
+import { bundledPackPath } from '../src/core/schema-pack/bundled-assets.ts';
describe('#2117: gbrain-base-v2 NER verb routes', () => {
- const p = new URL('../src/core/schema-pack/base/gbrain-base-v2.yaml', import.meta.url);
- const v2 = parseSchemaPackManifest(parseYamlMini(readFileSync(p, 'utf-8')), {
- path: p.pathname,
- });
- const p1 = new URL('../src/core/schema-pack/base/gbrain-base.yaml', import.meta.url);
- const v1 = parseSchemaPackManifest(parseYamlMini(readFileSync(p1, 'utf-8')), { path: p1.pathname });
+ // The bundled packs, loaded from the asset path the runtime resolves.
+ const bundled = (name: string) => {
+ const path = bundledPackPath(name)!;
+ return parseSchemaPackManifest(parseYamlMini(readFileSync(path, 'utf-8')), { path });
+ };
+ const v2 = bundled('gbrain-base-v2');
+ const v1 = bundled('gbrain-base');
test('founded/invested_in/advises/works_at resolve via pack regexes for NER', () => {
expect(inferNerLinkType(v2, 'person', 'co-founded Acme Corp last year')).toBe('founded');
diff --git a/test/test-reads-source-smell.test.ts b/test/test-reads-source-smell.test.ts
index abfe53a885..66edfa126c 100644
--- a/test/test-reads-source-smell.test.ts
+++ b/test/test-reads-source-smell.test.ts
@@ -92,7 +92,6 @@ const GRANDFATHERED: Record<string, number> = {
'fix-wave-structural.test.ts': 20,
'jobs-embed-background-parity.serial.test.ts': 1,
'lens-pack-manifests.test.ts': 1,
- 'link-inference-pack.test.ts': 1,
'link-source-check-repair.test.ts': 1,
'longmemeval-embed-cache.test.ts': 1,
'loops-extract-wiring.test.ts': 1,