Регистрация V2: не проверено end-to-end

This commit is contained in:
AidarKC
2026-10-23 19:21:52 +03:00
parent 6c8159c5f7
commit cab26bbf41
95 changed files with 4469 additions and 1088 deletions
+21
View File
@@ -0,0 +1,21 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { validateLoginOrThrow } from '../server-ui/js/server-ui-shared.js';
const read = p => readFileSync(new URL(p, import.meta.url), 'utf8');
test('server UI принимает полные логины и legacy при обновлении', () => {
assert.equal(validateLoginOrThrow('server@shine'), 'server@shine');
assert.equal(validateLoginOrThrow('old_server'), 'old_server');
assert.throws(() => validateLoginOrThrow('x'.repeat(26)+'@shine'));
assert.throws(() => validateLoginOrThrow('server@@shine'));
assert.throws(() => validateLoginOrThrow('server.name@shine'));
});
test('форма создания требует namespace type1 и правильный fee payer', () => {
const page = read('../server-ui/js/create-server-pda-page.js');
const service = read('../js/services/shine-user-pda-service.js');
const html = read('../server-ui/create-server-pda.html');
assert.match(page, /namespace\.type !== 1/);
assert.match(page, /getNamespace\(/);
assert.match(html, /maxlength="30"/);
assert.match(service, /feePayerPrivatePkcs8B64: keyBundle\.clientPair\.privatePkcs8B64/);
});