SHA256
Улучшить UI регистрации и связанные сценарии
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const read = (path) => readFileSync(new URL(path, import.meta.url), 'utf8');
|
||||
const upgrade = read('../js/pages/registration-upgrade-view.js');
|
||||
const direct = read('../js/pages/registration-payment-view.js');
|
||||
const styles = read('../styles/features/preauth.css');
|
||||
|
||||
test('новая регистрация и платный переход используют общую видимую панель кошелька', () => {
|
||||
for (const source of [direct, upgrade]) {
|
||||
assert.match(source, /registration-payment-card/);
|
||||
assert.match(source, /Ваш Solana-кошелёк в Сиянии/);
|
||||
assert.match(source, /Скопировать адрес/);
|
||||
assert.match(source, /registration-payment-copy-btn/);
|
||||
assert.match(source, /registration-payment-balance-value/);
|
||||
assert.match(source, /registration-payment-refresh-btn/);
|
||||
assert.match(source, /↻ Обновить/);
|
||||
assert.match(source, /registration-payment-topup-btn/);
|
||||
assert.match(source, /secondary-btn registration-payment-action/);
|
||||
}
|
||||
});
|
||||
|
||||
test('баланс и его обновление находятся в одной строке, а сумма визуально выделена', () => {
|
||||
assert.match(styles, /\.registration-payment-balance\s*\{[^}]*display:\s*flex/s);
|
||||
assert.match(styles, /\.registration-payment-balance-value\s*\{[^}]*font-size:\s*clamp\(/s);
|
||||
assert.match(styles, /\.registration-payment-action\s*\{[^}]*border:\s*1px solid/s);
|
||||
assert.match(upgrade, /balanceRow\.append\(balanceInfo, refreshButton\)/);
|
||||
assert.match(direct, /balanceRow\.append\(balanceInfo, refreshButton\)/);
|
||||
});
|
||||
|
||||
test('обе страницы используют стоимость namespace с депозитом внутри', () => {
|
||||
assert.match(direct, /calculateRegistrationFunding\(/);
|
||||
assert.match(direct, /loadFunding\(\)/);
|
||||
assert.match(direct, /getMinimumBalanceForRentExemption\(USER_PDA_SPACE/);
|
||||
assert.doesNotMatch(direct, /namespaceFeeSol \+ 0\.004/);
|
||||
assert.match(upgrade, /calculateUpgradeFunding\(\{ namespaceFeeLamports: namespace\.registrationFeeLamports, rentLamports \}\)/);
|
||||
assert.match(upgrade, /Депозит PDA уже включён/);
|
||||
assert.match(upgrade, /if \(isDevnet\) payment\.append\(topupButton, testHint\)/);
|
||||
assert.match(direct, /if \(isTestContour\) \{/);
|
||||
});
|
||||
Reference in New Issue
Block a user