TSX35 linhas1.182 bytes
apps/web/src/components/DonationWallets.test.tsx
SHA-256
ae61d43b889a7f30d1c4f01305a5dff3f3da67d1fdb5f41d4c1fff44817d5bf1
Somente leiturafonte-acf635076da2
import assert from 'node:assert/strict'
import test from 'node:test'
import React from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import DonationWalletCard from './DonationWalletCard'
import DonationWallets from './DonationWallets'
import type { DonationWallet } from '@/lib/donations'
const wallet: DonationWallet = {
asset: 'Bitcoin',
symbol: 'BTC',
network: 'Bitcoin',
address: 'bc1qexampleaddress000000000000000000000000',
uriScheme: 'bitcoin',
explorerBaseUrl: 'https://mempool.space/address/',
networkWarning: 'Envie somente BTC pela rede Bitcoin.',
}
test('renderiza endereço, rede, QR e explorador', () => {
const html = renderToStaticMarkup(<DonationWalletCard wallet={wallet} />)
assert.match(html, new RegExp(wallet.address))
assert.match(html, /BTC · Bitcoin/)
assert.match(html, /Copiar endereço/)
assert.match(html, /Ver no explorador/)
assert.match(html, /QR code BTC na rede Bitcoin/)
})
test('renderiza estado seguro sem carteiras', () => {
const html = renderToStaticMarkup(<DonationWallets wallets={[]} />)
assert.match(html, /está sendo configurado/)
assert.doesNotMatch(html, /Copiar endereço/)
})