Add slider captcha for web login, VitePress documentation on GitHub Pages, and fixes for gallery delete refresh, pagination jump, and copy-format persistence.
28 lines
950 B
TypeScript
28 lines
950 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
__peekLoginCaptchaTargetForTests,
|
|
__resetLoginCaptchaStoreForTests,
|
|
confirmLoginCaptcha,
|
|
createLoginCaptchaChallenge,
|
|
verifyLoginCaptcha
|
|
} from './login-captcha'
|
|
|
|
describe('login-captcha', () => {
|
|
it('requires confirm before login verify', () => {
|
|
__resetLoginCaptchaStoreForTests()
|
|
const { id } = createLoginCaptchaChallenge()
|
|
const target = __peekLoginCaptchaTargetForTests(id)!
|
|
expect(verifyLoginCaptcha(id, target)).toBe(false)
|
|
expect(confirmLoginCaptcha(id, target)).toBe(true)
|
|
expect(verifyLoginCaptcha(id, target)).toBe(true)
|
|
expect(verifyLoginCaptcha(id, target)).toBe(false)
|
|
})
|
|
|
|
it('rejects position outside tolerance', () => {
|
|
__resetLoginCaptchaStoreForTests()
|
|
const { id } = createLoginCaptchaChallenge()
|
|
const target = __peekLoginCaptchaTargetForTests(id)!
|
|
expect(confirmLoginCaptcha(id, target + 10)).toBe(false)
|
|
})
|
|
})
|