forked from yvv/decision
v3 : relecture de 7ffa4fd — un refus du nœud lâche le bulletin, le reçu ne dit vérifié que ce que scelle l'empreinte
polkadot-api lève InvalidTxError (JSON indenté) quand le nœud refuse la transaction : elle est désormais lue comme « la chaîne a dit non » (rien n'est parti, le bulletin est lâché), au lieu de rester en attente 24 h. La page /bulletins ne présente comme vérifiés que la version, la révision et le choix ; l'article, le titre et le bloc du reçu sont dits hors du sceau. ADR 0008 : trois affirmations corrigées (indexeur sans filtre, débit de la tâche de fond, lectures qui n'utilisent pas encore shown_tally). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { InvalidTxError } from 'polkadot-api';
|
||||
import { amountText, geckoLink } from '../../src/lib/wallet/gecko';
|
||||
import { failure, injectedNames, mayLetGo, testExtrinsic } from '../../src/lib/wallet/injected';
|
||||
|
||||
@@ -35,6 +36,17 @@ describe('wallets of the page', () => {
|
||||
expect(failure({ code: 1010, message: 'Invalid Transaction' })).toBe('chain');
|
||||
});
|
||||
|
||||
it('a refusal of the node, as polkadot-api raises it, is the chain saying no (relecture of 7ffa4fd)', () => {
|
||||
// The real class: its message is indented JSON (`"type": "Invalid"`, with a space).
|
||||
for (const reason of ['Stale', 'AncientBirthBlock', 'BadProof', 'ExhaustsResources', 'Future']) {
|
||||
const e = new InvalidTxError({ type: 'Invalid', value: { type: reason } });
|
||||
expect(failure(e), reason).toBe('chain');
|
||||
expect(mayLetGo(failure(e), true), reason).toBe(true);
|
||||
}
|
||||
expect(failure(new InvalidTxError({ type: 'Invalid', value: { type: 'Payment' } }))).toBe('funds');
|
||||
expect(failure(new InvalidTxError({ type: 'Unknown', value: { type: 'CannotLookup' } }))).toBe('chain');
|
||||
});
|
||||
|
||||
it('a ballot is let go when nothing left the page, or when the chain said no — kept when it may still land', () => {
|
||||
// Before the signature (the node down before sending, a refusal, the window closed): nothing left.
|
||||
for (const f of ['node', 'wallet', 'cancelled', 'funds', 'account', 'chain'] as const) expect(mayLetGo(f, false), f).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user