Initial Commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
import { BetterAuthSurrealError } from "../error-codes/error-codes.js";
|
||||
import { compileSelect } from "./compile-select.js";
|
||||
|
||||
describe("compileSelect", () => {
|
||||
it("returns * for undefined", { timeout: 5000 }, () => {
|
||||
expect(compileSelect(undefined)).toBe("*");
|
||||
});
|
||||
|
||||
it("returns * for empty array", { timeout: 5000 }, () => {
|
||||
expect(compileSelect([])).toBe("*");
|
||||
});
|
||||
|
||||
it("joins valid identifiers with comma-space", { timeout: 5000 }, () => {
|
||||
expect(compileSelect(["id", "email"])).toBe("id, email");
|
||||
});
|
||||
|
||||
it("rejects invalid identifier", { timeout: 5000 }, () => {
|
||||
expect(() => compileSelect(["id", "weird-name"])).toThrow(
|
||||
BetterAuthSurrealError
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user