Add architectural review for like-tip-memo

- Add three boundary unit tests to memo-like (tip == max, spendable ==
  dust, tip == spendable) closing mutation survivors.
- Refresh mutate4javascript and acceptance-mutation manifests from normal
  tool runs.
- Add written architectural review report for like-tip-memo.

By architect.
This commit is contained in:
Chris Troutner
2026-08-26 06:40:27 -07:00
parent 6b7a7e2b86
commit 61d50dfa88
4 changed files with 125 additions and 0 deletions
+42
View File
@@ -159,6 +159,35 @@ test('a tip above the hard maximum is rejected with a maximum error', async () =
)
})
test('a tip at exactly the hard maximum is accepted', async () => {
const wallet = fakeWallet({
cashAddress: MY_ADDRESS,
utxos: [{ txid: 'u1', value: MemoLike.MAX_TIP_SATS + 1000 }]
})
const memoLike = new MemoLike({ wallet })
const txid = await memoLike.like(POST_TXID, MemoLike.MAX_TIP_SATS, AUTHOR_ADDRESS)
assert.equal(txid, 'fake-txid')
assert.equal(wallet.broadcasts.length, 1)
assert.deepEqual(wallet.broadcasts[0].bchOutput, [
{ address: AUTHOR_ADDRESS, amountSat: MemoLike.MAX_TIP_SATS }
])
})
test('a wallet with exactly the dust-limit balance can make a pure like', async () => {
const wallet = fakeWallet({
cashAddress: MY_ADDRESS,
utxos: [{ txid: 'u1', value: MemoLike.DUST_LIMIT_SATS }]
})
const memoLike = new MemoLike({ wallet })
const txid = await memoLike.like(POST_TXID, 0, AUTHOR_ADDRESS)
assert.equal(txid, 'fake-txid')
assert.equal(wallet.broadcasts.length, 1)
})
test('a tip above the spendable balance is rejected with a balance error', async () => {
await assertLikeRejected(
fakeWallet({ utxos: [{ txid: 'u1', value: 30000 }] }),
@@ -167,6 +196,19 @@ test('a tip above the spendable balance is rejected with a balance error', async
)
})
test('a tip at exactly the spendable balance is accepted', async () => {
const wallet = fakeWallet({
cashAddress: MY_ADDRESS,
utxos: [{ txid: 'u1', value: 25000 }]
})
const memoLike = new MemoLike({ wallet })
const txid = await memoLike.like(POST_TXID, 25000, AUTHOR_ADDRESS)
assert.equal(txid, 'fake-txid')
assert.equal(wallet.broadcasts.length, 1)
})
test('a wallet with zero spendable balance cannot like', async () => {
await assertLikeRejected(fakeWallet({ utxos: [] }), 0, 'like_empty_balance')
})