This commit is contained in:
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'
|
||||
import { hashPassword, verifyPassword } from '../../server/utils/password.js'
|
||||
|
||||
describe('password', () => {
|
||||
it('hashes and verifies', () => {
|
||||
it('hashes and verifies password', () => {
|
||||
const password = 'secret123'
|
||||
const stored = hashPassword(password)
|
||||
expect(stored).toContain(':')
|
||||
@@ -14,8 +14,10 @@ describe('password', () => {
|
||||
expect(verifyPassword('wrong', stored)).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects invalid stored format', () => {
|
||||
expect(verifyPassword('a', '')).toBe(false)
|
||||
expect(verifyPassword('a', 'nocolon')).toBe(false)
|
||||
it.each([
|
||||
['a', ''],
|
||||
['a', 'nocolon'],
|
||||
])('rejects invalid stored format: password=%s, stored=%s', (password, stored) => {
|
||||
expect(verifyPassword(password, stored)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user