SHA256
Исправить восстановление входа при занятом WebSocket
This commit is contained in:
@@ -10,6 +10,8 @@ const finish = paymentView.split('export async function completeRegistrationLogi
|
||||
test('Solana и Arweave используют единое завершение регистрации', () => {
|
||||
assert.match(paymentView, /await completeRegistrationLogin\(\{ navigate, keyBundle \}\)/);
|
||||
assert.match(emailView, /await completeRegistrationLogin\(\{\s*navigate,\s*keyBundle:\s*draft\.preGeneratedKeyBundle\s*\}\)/);
|
||||
assert.match(emailView, /if \(!draft\.dataItemId\) \{/);
|
||||
assert.match(paymentView, /authService\.resetConnection\(state\.entrySettings\.shineServer, \{ clearSessionContext: true \}\)/);
|
||||
});
|
||||
|
||||
test('после авторизации на завершении регистрации создаётся HEADER с актуальными логином и ключом', () => {
|
||||
@@ -22,6 +24,13 @@ test('сбой HEADER не отменяет регистрацию; защита
|
||||
assert.match(authService, /if \(!_skipHeaderEnsure && !isHeader\) \{\s*await this\.ensureBlockchainHeader\(cleanLogin, storagePwd\)/);
|
||||
});
|
||||
|
||||
test('новый вход восстанавливается на новом WebSocket после ALREADY_AUTHED', () => {
|
||||
assert.match(authService, /if \(this\.ws\.isSessionReady\(\)\) \{[\s\S]*?this\.resetConnection\(this\.serverUrl, \{ clearSessionContext: true \}\);/);
|
||||
assert.match(authService, /for \(let attempt = 0; attempt < 2; attempt \+= 1\) \{[\s\S]*?challengeResp = await this\.ws\.request\('AuthChallenge'/);
|
||||
assert.match(authService, /attempt === 0 && error\.code === 'ALREADY_AUTHED'/);
|
||||
assert.match(authService, /this\.resetConnection\(this\.serverUrl, \{ clearSessionContext: true \}\);[\s\S]*?continue;/);
|
||||
});
|
||||
|
||||
// Проверяем выполнение настоящей функции с изолированными зависимостями:
|
||||
// ошибка HEADER не должна прерывать завершение регистрации.
|
||||
async function simulateCompletion({ headerFails = false } = {}) {
|
||||
@@ -36,6 +45,7 @@ async function simulateCompletion({ headerFails = false } = {}) {
|
||||
};
|
||||
const authService = {
|
||||
async reconnect() {},
|
||||
resetConnection() {},
|
||||
async createSessionForExistingUser() {
|
||||
return { login: 'AlexSmith@shine', storagePwd: 'stored', sessionId: 'test-session', sessionMaterial: {} };
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user