mirror of
https://github.com/zhigang1992/pocketbase-typegen.git
synced 2026-01-12 22:49:39 +08:00
16 lines
465 B
TypeScript
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()
|
|
})
|