SHA256
35 lines
1.8 KiB
JavaScript
35 lines
1.8 KiB
JavaScript
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/);
|
|
});
|