24 lines
807 B
TypeScript
24 lines
807 B
TypeScript
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
|
|
);
|
|
});
|
|
});
|