Skip to content

test(ledger): add idempotency and concurrency tests [REN-80] - #114

Merged
Scott Graham (cheddarfox) merged 1 commit into
devfrom
REN-80-ledger-idempotency-tests
Mar 9, 2026
Merged

Scott Graham (cheddarfox) merged 1 commit into
devfrom
REN-80-ledger-idempotency-tests

Conversation

@cheddarfox

Copy link
Copy Markdown
Member

Summary

  • 12 tests across 4 classes validating ledger idempotency, balance consistency, and edge cases
  • Tests: duplicate reference returns existing entry, different directions allowed, sequential ops maintain balance, overdraft raises InsufficientCreditsError, fractional/large values, multi-user independence

Test plan

  • TestAllocateIdempotency (3 tests) — duplicate ref, different refs, cross-direction
  • TestDeductIdempotency (2 tests) — duplicate debit ref, shared ref across directions
  • TestBalanceConsistency (4 tests) — sequential ops, exact zero, overdraft, zero-balance deduct
  • TestEdgeCases (3 tests) — min precision 0.0001, max Numeric(12,4), multi-user isolation

🤖 Generated with Claude Code

Adds 12 tests in 4 classes covering allocate/deduct idempotency,
running balance consistency, and edge cases (precision, limits,
multi-user isolation) for the credit ledger service.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cheddarfox
Scott Graham (cheddarfox) merged commit 8edca5b into dev Mar 9, 2026
11 of 13 checks passed
@cheddarfox
Scott Graham (cheddarfox) deleted the REN-80-ledger-idempotency-tests branch March 9, 2026 23:11
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.

1 participant