SHA256
Добавить систему поддержки SHiNE
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { supportStatsValues } from '../js/components/support-stats.js';
|
||||
|
||||
function file(path) { return readFileSync(new URL(path, import.meta.url), 'utf8'); }
|
||||
|
||||
test('three displayed counters: full sent, net received, sent/10 + direct', () => {
|
||||
assert.deepEqual(supportStatsValues({ supportSent: 1_000_000_000n, supportReceived: 900_000_000n, daoDirect: 200_000_000n }), [1_000_000_000n, 900_000_000n, 300_000_000n]);
|
||||
assert.deepEqual(supportStatsValues({}), [0n, 0n, 0n]);
|
||||
});
|
||||
|
||||
test('profile views attach counters from Solana PDA and support user action', () => {
|
||||
assert.match(file('../js/pages/profile-view.js'), /attachSupportStats\(body/);
|
||||
const other = file('../js/pages/user-profile-view.js');
|
||||
assert.match(other, /attachSupportStats\(body/);
|
||||
assert.match(other, /data-profile-action=\\?"support/);
|
||||
assert.match(other, /openShineSupportDialog\(\{ recipientLogin: card\.login/);
|
||||
});
|
||||
|
||||
test('wallet supports direct SHiNE economy donation', () => {
|
||||
const wallet = file('../js/pages/wallet-view.js');
|
||||
assert.match(wallet, /id="donate-shine"/);
|
||||
assert.match(wallet, /openShineSupportDialog\(\{ onSuccess/);
|
||||
});
|
||||
|
||||
test('message buttons pass checked block hashes, not message text', () => {
|
||||
for (const page of ['channel-view.js', 'channel-thread-view.js']) {
|
||||
const src = file(`../js/pages/${page}`);
|
||||
assert.match(src, /hexHash32\(rootHash\)/);
|
||||
assert.match(src, /hexHash32\(msgHash\)|hexHash32\(messageHash\)/);
|
||||
assert.match(src, /type: 2/);
|
||||
}
|
||||
});
|
||||
|
||||
test('shared modal protects direct and tracked workflows', () => {
|
||||
const src = file('../js/components/shine-support-dialog.js');
|
||||
assert.match(src, /supportShineUserOnSolana/);
|
||||
assert.match(src, /supportShineDaoOnSolana/);
|
||||
assert.match(src, /transferSolLamports/);
|
||||
assert.match(src, /window\.confirm\(t\('screens\.support_phase2\.direct_warning'\)\)/);
|
||||
assert.match(src, /amount % 10n/);
|
||||
});
|
||||
Reference in New Issue
Block a user