test: cover full client resolve glue in LookupModule - #23
Merged
Conversation
Add tests/modules/lookup.test.ts exercising the real LookupModule (name→appID parsing and client construction) instead of mocking it. Raises lookup.ts to 100% and base.ts resolve-path coverage substantially.
Contributor
|
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Closes a coverage gap left after the
@txnlab/nfd-sdk/lookuprefactor (#20): the fullNfdClient's resolve path was largely untested becausetests/client.test.tsmocksLookupModulewholesale. The shared parsing it delegates to is already well covered (nfd-record.test.ts,registry-box.test.ts), so this adds tests for the thin fetching/glue layer specific to the full client.tests/modules/lookup.test.tsexercises the realLookupModule(no mock), following themetadata.test.tspattern of instantiating the module directly with a mock client and theAppStatefixture helpers fromlookup-entry.test.ts.algorand.client.getTypedAppClientByIdto dispatch by typed-client class, returning fakes shaped like the realNfdRegistryClient(.appClient.getBoxValue) andNfdInstanceClient(.appAddress+.appClient.getGlobalState/getBoxNames/getBoxValue).viewpropagation. Deliberately avoids duplicating the box-parsing/state-matrix assertions already innfd-record.test.ts.Coverage impact:
src/modules/lookup.tssrc/modules/base.tsRemaining
base.tsgaps (requireSigner,getConstraints) are off the resolve path and out of scope here.Test plan
pnpm --filter @txnlab/nfd-sdk testpasses (143 tests, incl. 8 newLookupModuletests)pnpm --filter @txnlab/nfd-sdk lintpassespnpm --filter @txnlab/nfd-sdk typecheckpassespnpm --filter @txnlab/nfd-sdk test:coverageconfirmslookup.ts/base.tsresolve-path coverage rises substantially