Skip to content

test(frontend): optimistic rollback tests for useRepayLoan/useDepositToPool/useWithdrawFromPool#1278

Merged
ogazboiz merged 2 commits into
LabsCrypt:mainfrom
kingbitnation:test/1226-optimistic-rollback-hooks
Jun 28, 2026
Merged

test(frontend): optimistic rollback tests for useRepayLoan/useDepositToPool/useWithdrawFromPool#1278
ogazboiz merged 2 commits into
LabsCrypt:mainfrom
kingbitnation:test/1226-optimistic-rollback-hooks

Conversation

@kingbitnation

Copy link
Copy Markdown
Contributor

Summary

  • Adds useApi.optimisticRollback.test.tsx covering optimistic onMutate snapshots, onError rollbacks, and onSettled invalidation for useRepayLoan, useWithdrawFromPool, and useDepositToPool.
  • Verifies useRepayLoan updates loan detail (including status flip to repaid) and restores loan detail / borrower loans / pool stats on failure.
  • Verifies useWithdrawFromPool clamps depositAmount and totalDeposits at 0 and rolls back on failure.

Closes #1226

Test plan

  • npm test -- --testPathPatterns=useApi.optimisticRollback (9 tests passing)
  • CI green on PR

…ions

Cover useRepayLoan, useWithdrawFromPool, and useDepositToPool onMutate
snapshots, onError rollbacks, and onSettled invalidation for LabsCrypt#1226.
@ogazboiz ogazboiz merged commit c232bbb into LabsCrypt:main Jun 28, 2026
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing] Optimistic-update rollback in useRepayLoan/useDepositToPool/useWithdrawFromPool is completely untested

2 participants