/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/stores/tests/profile.test.ts
47 строк
1 KB
chrisnojima
build(mobile): harden gobuild.sh and go bind pipeline 2 (#29364)
08 июл 2026, 15:25
Не верифицирован
08 июл 2026, 15:25
19b55b3
Код
Авторство
О чём код?
/// <reference types="jest" /> import {validatePgpInfo} from '@/profile/pgp/choice' import {normalizeProofUsername} from '@/profile/proof-utils' import {resetAllStores} from '@/util/zustand' beforeEach(() => { resetAllStores() }) afterEach(() => { resetAllStores() }) test('normalizeProofUsername normalizes http proofs to the bare hostname', () => { const result = normalizeProofUsername('https', 'https://example.com:3000/path/to/proof') expect(result.normalized).toBe('example.com') expect(result.valid).toBe(true) }) test('normalizeProofUsername validates bitcoin addresses', () => { expect(normalizeProofUsername('btc', 'not-a-btc-address').valid).toBe(false) expect(normalizeProofUsername('btc', '1BoatSLRHtKNngkdXEeobR76b53LETtpyT').valid).toBe(true) }) test('validatePgpInfo derives validation errors from local form state', () => { let result = validatePgpInfo({ pgpEmail1: 'bad-email', pgpEmail2: 'also-bad', pgpEmail3: '', pgpFullName: 'Alice', }) expect(result.pgpErrorEmail1).toBe(true) expect(result.pgpErrorEmail2).toBe(true) expect(result.pgpErrorEmail3).toBe(false) result = validatePgpInfo({ pgpEmail1: 'alice@keybase.io', pgpEmail2: '', pgpEmail3: '', pgpFullName: 'Alice', }) expect(result.pgpErrorEmail1).toBe(false) expect(result.pgpErrorText).toBe('') })