Skip to content

Commit

Permalink
Update test to use library loadFromPath
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongwartz committed Aug 6, 2024
1 parent 031634a commit d949243
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions e2e/only_primitives/primitives.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { describe, expect, it } from "@jest/globals";
import { loadFromPath } from "@pkl-community/pkl-typescript";
import { join } from "path";

import pklGenTypescript from "../../pkl-gen-typescript/main";
import { join } from "path";

describe("E2E of config with only primitive values", () => {
it("can generate TypeScript sources and load valid values", async () => {
await pklGenTypescript([join(__dirname, "schema.pkl")]);
const configPkl = await import(join(__dirname, "../../.out/schema.pkl.ts"));
const config = await configPkl.loadFromPath(join(__dirname, "correct.pkl"));
const config = await loadFromPath(join(__dirname, "correct.pkl"));
expect(config).toStrictEqual({
addr: "localhost",
port: 3000,
Expand All @@ -22,12 +22,7 @@ describe("E2E of config with only primitive values", () => {
"can generate TypeScript sources but error on evaluating invalid values: %s",
async (_, fileBase) => {
await pklGenTypescript([join(__dirname, "schema.pkl")]);
const configPkl = await import(
join(__dirname, "../../.out/schema.pkl.ts")
);
await expect(
configPkl.loadFromPath(join(__dirname, `${fileBase}.pkl`))
).rejects.toThrowError();
}
await expect(loadFromPath(join(__dirname, `${fileBase}.pkl`))).rejects.toThrowError();
},
);
});

0 comments on commit d949243

Please sign in to comment.