mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
38 lines
1015 B
TypeScript
38 lines
1015 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { PrimaryField } from "../../../../src/data";
|
|
|
|
describe("[data] PrimaryField", async () => {
|
|
const field = new PrimaryField("primary");
|
|
|
|
test("name", async () => {
|
|
expect(field.name).toBe("primary");
|
|
});
|
|
|
|
test("schema", () => {
|
|
expect(field.name).toBe("primary");
|
|
expect(field.schema()).toEqual(["primary", "integer", expect.any(Function)]);
|
|
});
|
|
|
|
test("hasDefault", async () => {
|
|
expect(field.hasDefault()).toBe(false);
|
|
expect(field.getDefault()).toBe(undefined);
|
|
});
|
|
|
|
test("isFillable", async () => {
|
|
expect(field.isFillable()).toBe(false);
|
|
});
|
|
|
|
test("isHidden", async () => {
|
|
expect(field.isHidden()).toBe(false);
|
|
});
|
|
|
|
test("isRequired", async () => {
|
|
expect(field.isRequired()).toBe(false);
|
|
});
|
|
|
|
test("transformPersist/Retrieve", async () => {
|
|
expect(field.transformPersist(1)).rejects.toThrow();
|
|
expect(field.transformRetrieve(1)).toBe(1);
|
|
});
|
|
});
|