Repository navigation
test(env): add comprehensive unit test coverage for validateStellarNetwork (#420) - #424
Open
PINYOPATTANAWASANPORN wants to merge 1 commit into
Conversation
…twork (MergeFi#420) - Add tests verifying acceptance of valid networks (TESTNET, PUBLIC) - Verify strict rejection when unset or empty (no default network permitted) - Verify rejection of case-mismatched networks (testnet, public) - Verify rejection of near-misses (MAINNET) and invalid network strings
|
@PINYOPATTANAWASANPORN is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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 of Changes
validateStellarNetworkinsrc/lib/env.test.ts."TESTNET"and"PUBLIC".undefinedor empty string""is supplied (ensuring the lack of a silent default is enforced)."testnet"and"public")."MAINNET"and arbitrary strings.Root Cause / Technical Context
wallet.ts#signTransactionsigns transactions with. An incorrect network creates mismatched cryptographic signatures on Soroban escrow contracts.validateStellarNetworkinsrc/lib/env.tswas implemented to abort build-time and execution-time configuration errors,src/lib/env.test.tsonly testedvalidateApiUrl, leavingvalidateStellarNetworkwithout test coverage.Verification & Testing
src/lib/env.test.ts:accepts TESTNET: assertsvalidateStellarNetwork("TESTNET") === "TESTNET".accepts PUBLIC: assertsvalidateStellarNetwork("PUBLIC") === "PUBLIC".rejects undefined (no default allowed): assertsEnvValidationErrorthrown with/NEXT_PUBLIC_STELLAR_NETWORK is not set/.rejects an empty string: assertsEnvValidationErrorthrown.rejects lowercase 'testnet'&'public': asserts case sensitivity rejection with/is not a valid Stellar network/.rejects 'MAINNET' near-miss: assertsEnvValidationErrorthrown.rejects arbitrary invalid network strings: asserts invalid values throw.Closes #420