forked from baron/baron-sso
offline 스코프 제거, rp_claims 값 표준화
This commit is contained in:
32
devfront/src/features/clients/rpClaimDateTime.test.ts
Normal file
32
devfront/src/features/clients/rpClaimDateTime.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
claimDateTimeValueToInputString,
|
||||
dateTimeInputToUnixSeconds,
|
||||
unixSecondsToDateTimeInput,
|
||||
} from "./rpClaimDateTime";
|
||||
|
||||
describe("rpClaimDateTime", () => {
|
||||
it("converts date and datetime input in a selected timezone to Unix seconds", () => {
|
||||
expect(dateTimeInputToUnixSeconds("2026-06-10", "date", "Asia/Seoul")).toBe(
|
||||
1781017200,
|
||||
);
|
||||
expect(
|
||||
dateTimeInputToUnixSeconds("2026-06-09T10:30", "datetime", "Asia/Seoul"),
|
||||
).toBe(1780968600);
|
||||
});
|
||||
|
||||
it("formats stored Unix seconds for the selected timezone", () => {
|
||||
expect(unixSecondsToDateTimeInput(1781017200, "date", "Asia/Seoul")).toBe(
|
||||
"2026-06-10",
|
||||
);
|
||||
expect(
|
||||
unixSecondsToDateTimeInput(1780968600, "datetime", "Asia/Seoul"),
|
||||
).toBe("2026-06-09T10:30");
|
||||
});
|
||||
|
||||
it("uses Unix seconds values when hydrating date inputs", () => {
|
||||
expect(
|
||||
claimDateTimeValueToInputString(1780968600, "", "datetime", "Asia/Seoul"),
|
||||
).toBe("2026-06-09T10:30");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user