Skip to content

fix: repair broken test suite and add full MedInvoiceContract coverage#12

Open
PragyaTripathi990 wants to merge 1 commit into
seetadev:mainfrom
PragyaTripathi990:fix/broken-tests-and-coverage
Open

fix: repair broken test suite and add full MedInvoiceContract coverage#12
PragyaTripathi990 wants to merge 1 commit into
seetadev:mainfrom
PragyaTripathi990:fix/broken-tests-and-coverage

Conversation

@PragyaTripathi990

Copy link
Copy Markdown

Summary

  • test/MedToken.js was broken and could never run. It referenced a contract called MediToken which doesn't exist — the actual contract is PPTToken. Supply assertions also used raw 1000 instead of 1000 * 10**18 (which is what the constructor mints). Fixed contract name, updated all supply/balance assertions to use ethers.parseEther, added token name/symbol test, Transfer event test, and ERC-20 allowance tests.
  • test/MedInvoiceContract.js (new file) — adds 24 tests for the more complex contract: deployment checks, subscribe(), saveFile(), getFiles(), isSubscribed(), getSubscriptionDetails(), getUserTokens(), and withdrawTokens(), including edge cases and revert conditions.
  • package.json test script was echo "Error: no test specified". Changed to hardhat test.

Result: 33/33 tests passing.

Test plan

  • npm install --include=dev && npx hardhat test → 33 passing, 0 failing

Closes #7

🤖 Generated with Claude Code

test/MedToken.js referenced a non-existent contract 'MediToken' (contract is
'PPTToken') and asserted totalSupply == 1000 when the constructor mints
supply * 10**18. Fixed contract name, updated supply assertions to use
ethers.parseEther, added token name/symbol, Transfer event, and allowance tests.

Added test/MedInvoiceContract.js with 24 tests covering deployment, subscribe(),
saveFile(), getFiles(), isSubscribed(), getSubscriptionDetails(), getUserTokens(),
and withdrawTokens() — including edge cases and revert conditions.

Fixed package.json test script from placeholder echo to 'hardhat test'.

33/33 tests passing.

Closes seetadev#7
@PragyaTripathi990 PragyaTripathi990 force-pushed the fix/broken-tests-and-coverage branch from 5a90c05 to 87dfabb Compare May 10, 2026 11:56
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.

Proactively Detect and Fix Bugs – Focus on Database & Logic

1 participant