mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
public commit
This commit is contained in:
37
app/__test__/data/specs/fields/PrimaryField.spec.ts
Normal file
37
app/__test__/data/specs/fields/PrimaryField.spec.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user