mirror of
https://github.com/zhigang1992/pocketbase-typegen.git
synced 2026-01-12 17:32:56 +08:00
* add v0.8 schema * update system fields to handle base and auth collection types * handle relation fields with multiple items * create enums for select fields that have values * additional typecheck * add user field for backwards compatability * refactor strings * refactor system types * readme * Add lint and formatting (#17) * add linting and formatting * lint codebase * prettier * update test workflow * update test workflow again * fix: url login for pocketbase 0.8.0-rc2 servers (#16) Co-authored-by: Ethan Olsen <ethan@crowdhubapps.com> * e2e integration test (#18) * add dockerfile to run e2e tests * add db typegen * cleanup * add test * add github workflow * remove interactive flag * intentionally fail integration test * save artifacts in case of failing tests * fix output dir * ignore files Co-authored-by: Ethan Olsen <46045126+o2dependent@users.noreply.github.com> Co-authored-by: Ethan Olsen <ethan@crowdhubapps.com>
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({
|
|
out,
|
|
json: path.resolve(__dirname, "pb_schema.json"),
|
|
})
|
|
|
|
const fileOutput = await fs.readFile(out, { encoding: "utf-8" })
|
|
expect(fileOutput).toEqual(result)
|
|
expect(fileOutput).toMatchSnapshot()
|
|
})
|