Добавить поддержку SHiNE в кошелёк

This commit is contained in:
AidarKC
2026-11-13 18:52:26 +03:00
parent 2a72842a7a
commit 42a05a7a67
8 changed files with 71 additions and 14 deletions
@@ -0,0 +1,34 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const file = (path) => readFileSync(new URL(path, import.meta.url), 'utf8');
const ui = file('../js/pages/wallet-view.js');
const ru = JSON.parse(file('../js/i18n/locales/ru.json'));
const en = JSON.parse(file('../js/i18n/locales/en.json'));
for (const [locale, dict] of [['ru', ru], ['en', en]]) {
test(`${locale}: distinct menu descriptions for donations, obsolete storage and ticket flow`, () => {
const names = dict.screens.wallet_view;
assert.match(names.support_project_label, /SHiNE/i);
assert.ok(names.support_project_hint.length >= 20);
assert.match(names.text_122, locale === 'ru' ? /больше не используется/ : /no longer used/);
assert.notEqual(names.text_124, names.support_project_label);
assert.notEqual(names.text_189, names.support_project_label);
assert.ok(names.text_125);
});
}
test('menu opens existing DAO donation dialog without navigating to the Solana balance', () => {
const menu = ui.split('function renderWalletChoice()')[1].split('async function renderShineBlockchainWallet()')[0];
assert.match(menu, /support_project_label/);
assert.doesNotMatch(ui, /id="donate-shine"/, 'Solana wallet must not duplicate the donation button');
const order = ['renderSolanaWallet()', 'renderArweaveWallet()', 'renderTurboWallet()',
'openShineSupportDialog()', 'renderShineBlockchainWallet()', 'renderSupportHub()']
.map((entry) => menu.indexOf(entry));
assert.ok(order.every((position) => position >= 0));
assert.deepEqual(order, [...order].sort((a, b) => a - b));
assert.match(menu, /\(\) => openShineSupportDialog\(\)/);
assert.match(ui, /import \{ openShineSupportDialog \} from/);
assert.match(file('../js/components/shine-support-dialog.js'), /supportShineDaoOnSolana/);
});