Testing Guide
Full local lifecycle without guesswork
The safest way to validate FlashAlliance is to treat each test as a role-based scenario: participants fund, seller approves NFT, buyer approves FATK, and the alliance moves through one clean lifecycle.
Baseline local workflow
- Start a local node such as
npx hardhat node. - Deploy or bootstrap contracts on localhost and copy the printed token, factory, and faucet addresses into frontend env if needed.
- Restart the frontend dev server after changing
NEXT_PUBLIC_* addresses. - Mint or fund FATK balances for participants, faucet, and buyer roles.
- Create a new alliance with human FATK amounts, not raw smallest units.
Recommended role mapping
- Participant A: creates the alliance and funds one share.
- Participant B (and more if needed): funds the remaining shares and joins governance.
- Seller: owns the NFT before acquisition and uses the generated seller approval page.
- Buyer: receives the NFT during sale and uses the generated buyer approval page.
- Admin/owner: same wallet as creator unless you intentionally split admin management.
Core positive-path matrix
| Phase | What to test | Expected result |
|---|
| Create | Create alliance with valid participants, shares, target price, and min sale price. | Alliance stores correct target units and participant list. |
| Funding | Approve FATK and deposit exact quotas. | Total funded amount reaches target without exceeding any participant quota. |
| Acquisition | Seller approves NFT, participants vote exact acquisition tuple, then execute buy. | Alliance holds NFT and enters `Acquired`. |
| Sale | Participants vote sale, buyer approves FATK, then execute sale. | NFT leaves alliance, FATK enters alliance, proceeds are allocated. |
| Settlement | Participants claim proceeds. | Each wallet can claim only its fixed share and the alliance remains closed. |
Known local traps
- Restarting the local node wipes contracts and balances. Old alliance links become invalid.
- If seller or buyer approvals were created for an old alliance address, they must be regenerated for the new one.
- If create flow accidentally stores raw token units, that alliance is broken forever and must be discarded.
- After a sale is executed, the alliance is terminal. The next NFT must use a new alliance instance.