JUNOHUB-test/tests/l1/otpCrypto.test.ts
2026-04-12 00:40:25 +05:00

18 lines
628 B
TypeScript

import { describe, expect, it } from "vitest"
import { hashStorefrontOtp } from "@/lib/storefront-chat/otpCrypto"
describe("hashStorefrontOtp", () => {
it("is deterministic for same inputs", () => {
const a = hashStorefrontOtp("123456", "store1", "visitor1")
const b = hashStorefrontOtp("123456", "store1", "visitor1")
expect(a).toBe(b)
expect(a.length).toBe(64)
})
it("differs when code changes", () => {
const a = hashStorefrontOtp("123456", "store1", "visitor1")
const b = hashStorefrontOtp("000000", "store1", "visitor1")
expect(a).not.toBe(b)
})
})