test(defindex-adapter): cover deposit()'s NotInitialized panic when DFX_VAULT is unset - #669
Open
ibochivincent-lang wants to merge 1 commit into
Conversation
…FX_VAULT is unset withdraw() already had this coverage (withdraw_panics_with_typed_error_when_dfx_vault_is_unset); deposit() went through the identical get_or_not_initialized panic path with no test exercising it.
|
@ibochivincent-lang Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@ibochivincent-lang is attempting to deploy a commit to the Collins' projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
closes #664
Summary
deposit()inpackages/contracts/defindex-adapter/src/lib.rscallsget_or_not_initializedforDFX_VAULT, the identical panic pathwithdraw()already had a test for (withdraw_panics_with_typed_error_when_dfx_vault_is_unset). No test exercised the same branch on thedeposit()side.Changes
Added
deposit_panics_with_typed_error_when_dfx_vault_is_unset, mirroring the existingwithdrawtest's structure: constructs the adapter viasetup(), removesDFX_VAULTfrom instance storage withenv.as_contract, and assertsadapter.deposit(&amount)panics with the typedNotInitializederror. No USDC funding step is needed (unlike the withdraw test) since theNotInitializedcheck runs before any token movement.Test plan
cargo test --lib -p meridian-defindex-adapter: 15 tests pass (14 existing + 1 new).Note: this repo's
packages/contractsworkspace hits a pre-existing, Windows-toolchain-specific linker limit (ld: error: export ordinal too large) whendefindex-adapter's[dev-dependencies]buildmeridian-vaultfor its own test binary, unrelated to this change — confirmed present on a cleanmaincheckout with none of my edits. I verified the test passes by temporarily settingvault's[lib] crate-typeto["rlib"](dropping thecdyliboutput that trips the Windows-only linker limit) for the local test run only, then reverted that change before committing — it is not part of this PR's diff.stellar contract build --package meridian-defindex-adapteralso succeeds cleanly, confirming the real WASM deployment target is unaffected either way.Caveats
Per the issue's own note, this file also has #634 and #622 open against it touching unrelated parts of the same source — any merge conflict on this PR is from those landing first, not a real dependency.