Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma strängvärde byggs med konkatenering i stället för att matcha mönstret.
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
LOGIN_METHOD_COOKIE,
|
|
isLoginMethod,
|
|
persistLoginMethodHint,
|
|
} from '@/lib/auth/login-method'
|
|
|
|
describe('isLoginMethod', () => {
|
|
it('accepts the two supported methods', () => {
|
|
expect(isLoginMethod('bankid')).toBe(true)
|
|
expect(isLoginMethod('email')).toBe(true)
|
|
})
|
|
|
|
it('rejects anything else', () => {
|
|
expect(isLoginMethod('google')).toBe(false)
|
|
expect(isLoginMethod('password')).toBe(false)
|
|
expect(isLoginMethod('')).toBe(false)
|
|
expect(isLoginMethod(undefined)).toBe(false)
|
|
expect(isLoginMethod(null)).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('persistLoginMethodHint', () => {
|
|
it('is a no-op outside the browser', () => {
|
|
expect(() => persistLoginMethodHint('email')).not.toThrow()
|
|
})
|
|
})
|
|
|
|
describe('LOGIN_METHOD_COOKIE', () => {
|
|
// New wire identifiers use the accounted name; only pre-rebrand ones keep
|
|
// the gnubok prefix. Locks the name so a rename cannot silently strand the
|
|
// stored hints of every returning user.
|
|
it('stays on the accounted name', () => {
|
|
expect(LOGIN_METHOD_COOKIE).toBe('accounted-login-method')
|
|
})
|
|
})
|