Skip to content

Commit

Permalink
test: add test for loader
Browse files Browse the repository at this point in the history
description is missing
  • Loading branch information
pi0 committed Jan 19, 2024
1 parent c200c1c commit 5388749
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/fixtures/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const config = {
/** checked status */
checked: {
$default: false,
$schema: { deprecated: "use unchecked" },
},
};
39 changes: 39 additions & 0 deletions test/loader.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { describe, it, expect } from "vitest";
import { loadSchema } from "../src/loader/loader";

describe("loader", () => {
it("should load a schema", async () => {
const schema = await loadSchema("./test/fixtures/config.ts", {});
expect(schema).toMatchInlineSnapshot(`
{
"default": {
"config": {
"checked": false,
},
},
"id": "#",
"properties": {
"config": {
"default": {
"checked": false,
},
"id": "#config",
"properties": {
"checked": {
"default": false,
"deprecated": "use unchecked",
"description": "",
"id": "#config/checked",
"tags": [],
"title": "",
"type": "boolean",
},
},
"type": "object",
},
},
"type": "object",
}
`);
});
});

0 comments on commit 5388749

Please sign in to comment.