-
Notifications
You must be signed in to change notification settings - Fork 0
Add tests for entry type method generation #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
- Add test file to verify generated Post methods for entry types - Test hyphenated, camelCase, and underscore naming conventions - Test schemas with entry types that have lines defined - Verify method existence and functionality when methods are generated
- Consolidate tests into basic-test.test.ts to match existing test structure - Remove console.log statements to match existing test style - Simplify test names and variable names to match existing patterns - Test entry type methods with hyphenated, camelCase, and underscore naming
- Document how type-specific methods are generated for entry types with lines - Show examples with different naming conventions (hyphenated, camelCase, underscore) - Explain when methods are available and fallback to addLedgerEntry
- Try individual parameters first (amount as direct arg)
- Fall back to parameters object if individual params fail
- All entry types have required 'amount' parameter from {{amount}} template
- Add detectParameterStyle helper that throws if method signature is unexpected - Tests now explicitly fail if parameter style can't be determined - Add dedicated test to verify parameter style and ensure wrong style fails - Tests will catch API changes or incorrect method signatures
- Add EXPECTED_PARAMETER_STYLE constant to document expected signature - Replace detectParameterStyle with verifyParameterStyle that fails if signature doesn't match - Tests now explicitly use expected style and fail if it's wrong - Remove fallback logic - tests will fail if signature is unexpected
- Add tests/fixtures/test-schema.json with entry types - Generate GraphQL queries using Fragment CLI - Generate SDK from GraphQL queries - Add scripts/update-test-schema.sh for easy updates - Add CI check to verify generated files match schema - Add tests/generated-sdk.test.ts that imports generated SDK directly - Update EXPECTED_PARAMETER_STYLE to 'individual' (Fragment CLI generates individual params) - Update README to show correct parameter style
- Install Homebrew on Ubuntu runner - Install Fragment CLI from fragment-dev/tap - Use full path to fragment command in verification step
- Cache Homebrew installation directory and cache - Only install Homebrew if not cached - Check if Fragment CLI is installed before installing - Set up brew shellenv properly for cached installations
vigneshwerv
reviewed
Dec 11, 2025
- Update test schema to include user-funds-account with typeVersion 1 and 2 - Regenerate GraphQL queries and SDK (includes PostUserFundsAccount_v2) - Add typeVersion to GraphQL query response fields - Update test to verify both version 1 and version 2 entries can be posted - Test verifies typeVersion in response matches expected version
- Add expense-root account to schema
- Add fee-line to typeVersion 2 entry type using {{feeAmount}} parameter
- Adjust asset-line to account for fee: {{amount}} - {{feeAmount}}
- Update test to include expense account and pass feeAmount parameter
- Generated SDK now includes feeAmount as a required parameter for PostUserFundsAccount_v2
- Explain how typeVersion affects method naming - Show examples of version 1 vs version 2 method calls - Document that different versions can have different parameters
- Add typeVersion field to all entry response blocks in GraphQL queries - Regenerate SDK to include typeVersion in TypeScript types - Fixes TypeScript errors in tests that check typeVersion
- Fragment CLI doesn't include typeVersion in response by default - Add sed command to insert typeVersion after type field in all entry blocks - This ensures generated SDK includes typeVersion in TypeScript types - Regenerate files to match CI expectations
…tead - Remove sed command that added typeVersion to GraphQL queries - Tests now verify version differences by checking line structure - Version 1 has 2 lines, version 2 has 3 lines (including fee-line) - This tests what Fragment CLI actually generates, not modified output
vigneshwerv
approved these changes
Dec 11, 2025
Co-authored-by: Vigneshwer Vaidyanathan <vignesh.vaid@gmail.com>
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.
This PR adds tests to verify that the generated SDK exposes type-specific methods (e.g., PostUserFundsAccount, PostFundingSettlement) for entry types defined in schemas with lines.
Changes
Testing
Tests will verify: