Newer
Older
client_dwatch / lib / db / __tests__ / timetable-link.test.ts
import { describe, expect, it } from "vitest";
import { SCHEDULED_TIMETABLE_ID_WHERE, scheduledTimetableId } from "@/lib/db/timetable-link";

// 期待値表(TeamWorks 回答 2026-10-27: 0 は予定外。NULL も予定外のまま)
describe("scheduledTimetableId", () => {
  it.each([
    ["NULL", null, null],
    ["undefined", undefined, null],
    ["0(bigint)", BigInt(0), null],
    ["0(number)", 0, null],
    ["1(bigint)", BigInt(1), BigInt(1)],
    ["1001(number)", 1001, 1001],
    ["参照先の無い id もそのまま返す", BigInt(900000), BigInt(900000)],
  ] as const)("%s", (_label, raw, expected) => {
    expect(scheduledTimetableId(raw)).toEqual(expected);
  });
});

describe("SCHEDULED_TIMETABLE_ID_WHERE", () => {
  it("0 より大きい(=0 でも NULL でもない)", () => {
    expect(SCHEDULED_TIMETABLE_ID_WHERE).toEqual({ gt: BigInt(0) });
  });
});