Files
wikideck/tests/project-copy.test.ts
2026-10-22 14:40:00 -04:00

51 lines
3.1 KiB
TypeScript
Executable File

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
test('project overview distinguishes mining rewards, peer markets, planned TCGs and current payment status',async()=>{
const readme=await readFile(new URL('../README.md',import.meta.url),'utf8');
assert.match(readme,/mining a block rewards the miner with a collectible card based on a Wikipedia page/);
assert.match(readme,/algorithm also used by Monero/);
assert.match(readme,/consumer CPUs competitive/);
assert.match(readme,/custom games hosted by peers.*planned/);
assert.match(readme,/configurable hosting fee/);
assert.match(readme,/hardcoded \*\*1% author fee\*\*/);
assert.match(readme,/Checkout, fees and payouts are simulated/);
assert.match(readme,/new fixed-price listings and timed auctions use native XMR amounts/);
assert.match(readme,/does not yet contain a project LICENSE file/);
assert.doesNotMatch(readme,/## Mine only by explicit choice/);
});
test('homepage sells the collector vision while disclosing mining and market limits',async()=>{
const app=await readFile(new URL('../src/App.tsx',import.meta.url),'utf8');
assert.match(app,/Mine with your CPU/);
assert.match(app,/Build a deck that feels like yours/);
assert.match(app,/designed to resist specialized ASICs/);
assert.match(app,/ASIC resistance is a design goal, not a guarantee/);
assert.match(app,/New listings are priced in XMR, but all checkout, fees and payouts are simulated today/);
assert.match(app,/Playable TCGs, match systems, deck rules and peer-hosted custom games are not implemented yet/);
assert.match(app,/<details className="mining-details"><summary>Want to run a miner\? Setup &amp; safety details/);
assert.doesNotMatch(app,/Prices are in USD with XMR cryptocurrency settlement planned/);
assert.match(app,/--consent/); // Documentation-only change: runnable miner invocation keeps its existing required flag.
});
test('market transparency explains real controls without promising escrow, refunds or live payments',async()=>{
const guide=await readFile(new URL('../docs/market-transparency.md',import.meta.url),'utf8');
for(const required of [
/does not process real cryptocurrency payments/,
/Card delivery is real/,
/Listing is not escrow/,
/That would be custodial/,
/30 minutes after auction close/,
/48 hours after mock payment/,
/0\.096500000000 XMR/,
/cannot revoke a signed NFT transfer/,
/no built-in arbitration service/,
/the hosting operator and anyone with its database\/backups can read orders/,
/no live payment integration or supported setting/,
])assert.match(guide,required);
for(const name of ['../README.md','../docs/marketplace.md']){
assert.match(await readFile(new URL(name,import.meta.url),'utf8'),/market-transparency\.md/);
}
// Resolve every workspace-relative Markdown link in the new guide, catching missing documentation.
for(const match of guide.matchAll(/\]\(([^)]+\.md)(?:#[^)]*)?\)/g))await readFile(new URL(`../docs/${match[1]}`,import.meta.url),'utf8');
});