mirror of
https://github.com/saltbo/zpan.git
synced 2026-10-31 02:41:33 +08:00
* ci: parallelize and isolate test suites * ci: avoid unavailable Playwright video runtime * ci: shard coverage and cache docker smoke * ci: balance Playwright shards by test * ci: smoke test the CLI container * ci: enforce merged coverage thresholds * ci: ratchet canonical coverage baseline * ci: make coverage ratchet lossless * ci: organize parallel gates by responsibility * perf(ci): reduce total runner time * perf(ci): balance runner cost and latency * perf(ci): suppress passing test logs * fix(test): make coverage sorting proof deterministic * perf(docker): exclude test-only build inputs * perf(ci): scope Docker smokes to packaging changes * refactor(test): enforce fast test boundaries * test: isolate coverage ownership * perf(test): run backend projects concurrently * perf(ci): separate test layers by runtime * perf(test): separate integration boundaries * perf(ci): prioritize test runners * docs(ci): clarify package scheduling * test: restore shared Cloudflare mocks * fix(preview): isolate Cloudflare E2E build config * fix(auth): bind preview sessions to request origin * revert: remove ineffective preview auth workaround * fix(auth): stop signing JWTs on session reads
20 lines
718 B
TypeScript
20 lines
718 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { hashPassword, verifyPassword } from './password'
|
|
|
|
describe('password hashing boundary', () => {
|
|
it('round-trips the correct password and rejects a different password', () => {
|
|
const hash = hashPassword('correct horse battery staple')
|
|
|
|
expect(verifyPassword(hash, 'correct horse battery staple')).toBe(true)
|
|
expect(verifyPassword(hash, 'wrong password')).toBe(false)
|
|
})
|
|
|
|
it('uses a fresh salt for every hash', () => {
|
|
expect(hashPassword('same password')).not.toBe(hashPassword('same password'))
|
|
})
|
|
|
|
it('rejects malformed hashes without throwing', () => {
|
|
expect(verifyPassword('not-a-password-hash', 'password')).toBe(false)
|
|
})
|
|
})
|