Skip to content

Commit 5f08383

Browse files
dmealingclaude
andcommitted
fix(codegen-ts): migrate test sources from InMemorySource to InMemoryStringSource
The Python-loader-unification merge that landed on main (a3e6f65) renamed the metadata package's `InMemorySource` to `InMemoryStringSource` with a new constructor signature requiring an explicit { id, format } metadata argument. This branch's two new test files (prompt-render-file.test.ts and prompt-render-conformance.test.ts) were authored against the old API on a parallel timeline; the integration merge surfaced the breakage. Forward fix updates both to the new constructor shape: new InMemoryStringSource(json, { id: "...", format: "json" }) All 2548 tests now pass on the merged main; build is clean across all 14 packages. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 6e357b0 commit 5f08383

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

server/typescript/packages/codegen-ts/test/generators/prompt-render-file.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { describe, test, expect } from "bun:test";
2-
import { MetaDataLoader, InMemorySource } from "@metaobjectsdev/metadata";
2+
import { MetaDataLoader, InMemoryStringSource } from "@metaobjectsdev/metadata";
33
import { promptRender } from "../../src/generators/prompt-render-file.js";
44
import type { GenContext } from "../../src/generator.js";
55

66
async function loadRoot(children: unknown[]) {
77
const res = await new MetaDataLoader().load([
8-
new InMemorySource(JSON.stringify({ "metadata.root": { package: "acme::ai", children } })),
8+
new InMemoryStringSource(
9+
JSON.stringify({ "metadata.root": { package: "acme::ai", children } }),
10+
{ id: "meta.json", format: "json" },
11+
),
912
]);
1013
expect(res.errors).toEqual([]);
1114
return res.root;

server/typescript/packages/codegen-ts/test/golden/prompt-render-conformance.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import { describe, it, expect } from "bun:test";
1313
import { existsSync, readFileSync, readdirSync } from "node:fs";
1414
import { join, resolve } from "node:path";
15-
import { MetaDataLoader, InMemorySource } from "@metaobjectsdev/metadata";
15+
import { MetaDataLoader, InMemoryStringSource } from "@metaobjectsdev/metadata";
1616
import { promptRender } from "../../src/generators/prompt-render-file.js";
1717
import type { GenContext } from "../../src/generator.js";
1818

@@ -51,7 +51,10 @@ describe("promptRender() conformance — expected/prompts.ts byte-match", () =>
5151
// Load all .json files from the input directory
5252
const inputFiles = readdirSync(inputDir).filter((f) => f.endsWith(".json"));
5353
const sources = inputFiles.map((f) =>
54-
new InMemorySource(readFileSync(join(inputDir, f), "utf-8")),
54+
new InMemoryStringSource(
55+
readFileSync(join(inputDir, f), "utf-8"),
56+
{ id: f, format: "json" },
57+
),
5558
);
5659

5760
const res = await new MetaDataLoader().load(sources);

0 commit comments

Comments
 (0)