fix: repair broken test suite and add full MedInvoiceContract coverage#12
Open
PragyaTripathi990 wants to merge 1 commit into
Open
fix: repair broken test suite and add full MedInvoiceContract coverage#12PragyaTripathi990 wants to merge 1 commit into
PragyaTripathi990 wants to merge 1 commit into
Conversation
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
5a90c05 to
87dfabb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test/MedToken.jswas broken and could never run. It referenced a contract calledMediTokenwhich doesn't exist — the actual contract isPPTToken. Supply assertions also used raw1000instead of1000 * 10**18(which is what the constructor mints). Fixed contract name, updated all supply/balance assertions to useethers.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(), andwithdrawTokens(), including edge cases and revert conditions.package.jsontest script wasecho "Error: no test specified". Changed tohardhat test.Result: 33/33 tests passing.
Test plan
npm install --include=dev && npx hardhat test→ 33 passing, 0 failingCloses #7
🤖 Generated with Claude Code