Files
PicHost/server/utils/access.test.ts
T
O96u bc4cba7e52 release: PicHost v1.0.0
Multi-user image hosting with RBAC, upload preferences, and admin settings.
2026-08-22 14:36:57 +08:00

18 lines
626 B
TypeScript

import { describe, expect, it } from 'vitest'
import { createLegacySessionToken } from './access'
describe('createLegacySessionToken', () => {
it('returns a stable hex digest for the same secret', async () => {
const first = await createLegacySessionToken('test-secret')
const second = await createLegacySessionToken('test-secret')
expect(first).toBe(second)
expect(first).toMatch(/^[0-9a-f]{64}$/)
})
it('changes when the secret changes', async () => {
const a = await createLegacySessionToken('secret-a')
const b = await createLegacySessionToken('secret-b')
expect(a).not.toBe(b)
})
})