Добавить трёхшаговый UI регистрации

This commit is contained in:
AidarKC
2026-11-05 00:04:05 +03:00
parent c13734cbc9
commit 41d5e79f83
19 changed files with 900 additions and 170 deletions
@@ -30,7 +30,7 @@ test('free-регистрация передаёт ровно три публи
});
test('free экран вводит код из письма и ждёт Turbo, платный upgrade проверяет ключи',()=>{
const email=read('shine-UI/js/pages/registration-email-view.js');
assert.match(email,/6-значный код из письма/);assert.match(email,/confirmFreeRegistration/);
assert.match(email,/Введите код из письма/);assert.match(email,/confirmFreeRegistration/);
assert.doesNotMatch(email,/код 1111/);
assert.match(email,/completeRegistrationLogin/);
const upgrade=read('shine-UI/js/pages/registration-upgrade-view.js');
@@ -9,7 +9,7 @@ const finish = paymentView.split('export async function completeRegistrationLogi
test('Solana и Arweave используют единое завершение регистрации', () => {
assert.match(paymentView, /await completeRegistrationLogin\(\{ navigate, keyBundle \}\)/);
assert.match(emailView, /await completeRegistrationLogin\(\{navigate,keyBundle:draft\.preGeneratedKeyBundle\}\)/);
assert.match(emailView, /await completeRegistrationLogin\(\{\s*navigate,\s*keyBundle:\s*draft\.preGeneratedKeyBundle\s*\}\)/);
});
test('после авторизации на завершении регистрации создаётся HEADER с актуальными логином и ключом', () => {
@@ -64,16 +64,16 @@ async function simulateCompletion({ headerFails = false } = {}) {
return { calls, state };
}
test('после регистрации HEADER отправляется до открытия профиля', async () => {
test('после регистрации HEADER отправляется до экрана поздравления', async () => {
const { calls } = await simulateCompletion();
assert.deepEqual(calls[0], ['authorized', 'AlexSmith@shine']);
assert.deepEqual(calls[1], ['header', 'AlexSmith@shine', 'stored']);
assert.deepEqual(calls.at(-1), ['navigate', 'profile-view']);
assert.deepEqual(calls.at(-1), ['navigate', 'registration-success-view']);
});
test('при ошибке HEADER регистрацию не откатываем и остаёмся в аккаунте', async () => {
const { calls, state } = await simulateCompletion({ headerFails: true });
assert.ok(calls.some(item => item[0] === 'warning'));
assert.deepEqual(calls.at(-1), ['navigate', 'profile-view']);
assert.deepEqual(calls.at(-1), ['navigate', 'registration-success-view']);
assert.equal(state.registrationDraft.password, '');
});
@@ -0,0 +1,28 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
const read = relative => fs.readFileSync(new URL(relative, import.meta.url), 'utf8');
test('выбор аккаунта перед шагом 1, всего три шага', () => {
const choice = read('../js/pages/registration-choice-view.js');
const login = read('../js/pages/register-view.js');
const email = read('../js/pages/registration-email-view.js');
const payment = read('../js/pages/registration-payment-view.js');
assert.doesNotMatch(choice, /createRegistrationStepper\(/);
assert.match(login, /createRegistrationStepper\(1\)/);
assert.match(login, /createRegistrationStepper\(2\)/);
assert.match(email, /createRegistrationStepper\(3\)/);
assert.match(payment, /createRegistrationStepper\(3\)/);
});
test('реальная почта и 256-символьный лимит сохранены', () => {
const email = read('../js/pages/registration-email-view.js');
const passwords = read('../js/services/password-words.js');
assert.match(email, /startFreeRegistration\(/);
assert.match(email, /confirmFreeRegistration\(/);
assert.match(passwords, /PASSWORD_MAX_LENGTH = 256/);
});
test('экран поздравления объясняет различие статусов', () => {
const finish = read('../js/pages/registration-success-view.js');
assert.match(finish, /registrationSuccess\?\.flowType === 'paid'/);
assert.match(finish, /Arweave/);
assert.match(finish, /PDA/);
});