Files
pocketbase-typegen/test/fromJSON.test.ts
2023-02-07 20:49:18 -08:00

16 lines
465 B
TypeScript

import { promises as fs } from "fs"
import { main } from "../src/cli"
import path from "path"
it("creates a type file from json schema", async () => {
const out = path.resolve(__dirname, "pocketbase-types-example.ts")
const result = await main({
json: path.resolve(__dirname, "pb_schema.json"),
out,
})
const fileOutput = await fs.readFile(out, { encoding: "utf-8" })
expect(fileOutput).toEqual(result)
expect(fileOutput).toMatchSnapshot()
})