From 6416c1a77cff7115d3eb0a62a12a39e8a7f07df5 Mon Sep 17 00:00:00 2001 From: luckasRanarison Date: Tue, 3 Dec 2024 08:11:56 +0300 Subject: [PATCH] fix: metagen test --- tests/metagen/metagen_test.ts | 52 +---------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/tests/metagen/metagen_test.ts b/tests/metagen/metagen_test.ts index b09181088..85e0fd039 100644 --- a/tests/metagen/metagen_test.ts +++ b/tests/metagen/metagen_test.ts @@ -11,7 +11,7 @@ import { testDir } from "test-utils/dir.ts"; import $ from "@david/dax"; import { z as zod } from "zod"; import { workspaceDir } from "test-utils/dir.ts"; -import { FdkOutput } from "@typegraph/sdk/gen/typegraph_core.d.ts"; +import { FdkOutput } from "@typegraph/sdk/gen/core.ts"; import { createBucket } from "test-utils/s3.ts"; import { S3Client } from "aws-sdk/client-s3"; @@ -213,56 +213,6 @@ metagen: // } //}); - const sdkResults = [] as Array; - - await t.should("Run metagen within typescript", async () => { - const { tg } = await import("./typegraphs/metagen.ts"); - const { Metagen } = await import("@typegraph/sdk/metagen"); - const metagen = new Metagen(workspace, genConfig); - const generated = metagen.dryRun(tg, targetName); - const sorted = generated.sort((a, b) => a.path.localeCompare(b.path)); - await t.assertSnapshot(sorted); - - sdkResults.push(JSON.stringify(sorted, null, 2)); - }); - - await t.should("Run metagen within python", async () => { - const typegraphPath = join(import.meta.dirname!, "./typegraphs/metagen.py"); - const command = new Deno.Command("python3", { - args: [typegraphPath], - env: { - workspace_path: workspace, - gen_config: JSON.stringify(genConfig), - target_name: targetName, - }, - stderr: "piped", - stdout: "piped", - }); - - const child = command.spawn(); - const output = await child.output(); - if (output.success) { - const stdout = new TextDecoder().decode(output.stdout); - const generated = JSON.parse(stdout) as Array; - const sorted = generated.sort((a, b) => a.path.localeCompare(b.path)); - - await t.assertSnapshot(sorted); - - sdkResults.push(JSON.stringify(sorted, null, 2)); - } else { - const err = new TextDecoder().decode(output.stderr); - throw new Error(`metagen python: ${err}`); - } - }); - - if (sdkResults.length > 0) { - await t.should("SDKs should produce same metagen output", () => { - const [fromTs, fromPy] = sdkResults; - assertEquals(fromTs, fromPy); - }); - } -}); - Meta.test("Metagen within sdk with custom template", async (t) => { const workspace = join(import.meta.dirname!, "typegraphs").slice( workspaceDir.length,