Newer
Older
client_dwatch / lib / logger / __tests__ / timestamp.test.ts
import { describe, expect, test } from "vitest";
import { formatLogTimestamp } from "@/lib/logger/timestamp";

describe("formatLogTimestamp", () => {
  test("ISO 8601 で +09:00 を付ける(epoch の UTC 深夜は JST 9時)", () => {
    const iso = formatLogTimestamp(new Date("2026-08-27T00:00:00.000Z"));
    expect(iso).toBe("2026-08-27T09:00:00.000+09:00");
  });

  test("ミリ秒を3桁ゼロ詰めで残す", () => {
    const iso = formatLogTimestamp(new Date("2026-08-27T09:32:20.007Z"));
    expect(iso).toBe("2026-08-27T18:32:20.007+09:00");
  });
});