SHA256
Добавить поддержку SHiNE в кошелёк
This commit is contained in:
@@ -19,10 +19,11 @@ test('profile views attach counters from server cache and support user action',
|
||||
assert.match(other, /openShineSupportDialog\(\{ recipientLogin: card\.login/);
|
||||
});
|
||||
|
||||
test('wallet supports direct SHiNE economy donation', () => {
|
||||
test('wallet offers SHiNE economy donation through the menu, not the Solana wallet', () => {
|
||||
const wallet = file('../js/pages/wallet-view.js');
|
||||
assert.match(wallet, /id="donate-shine"/);
|
||||
assert.match(wallet, /openShineSupportDialog\(\{ onSuccess/);
|
||||
const menu = wallet.split('function renderWalletChoice()')[1].split('async function renderShineBlockchainWallet()')[0];
|
||||
assert.match(menu, /openShineSupportDialog\(\)/);
|
||||
assert.doesNotMatch(wallet, /id="donate-shine"/);
|
||||
});
|
||||
|
||||
test('message buttons pass checked block hashes, not message text', () => {
|
||||
|
||||
@@ -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/);
|
||||
});
|
||||
Reference in New Issue
Block a user