-
Notifications
You must be signed in to change notification settings - Fork 6
test: add comprehensive tests for printer functions #441
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
Conversation
- Add comprehensive tests for createObjectTypeCode function - Test various protobuf message types (simple, nested, oneof, empty) - Support both ts-proto and protobuf-es libraries - Include tests for messages with GraphQL extensions - Generate snapshots to verify code output 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for createEnumTypeCode function - Test simple enums, enums without unspecified value - Test nested enums and enums with extensions - Support both ts-proto and protobuf-es libraries 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for createInputObjectTypeCode function - Test simple inputs, nested fields, oneof fields, empty inputs - Test partial input types generation - Support both ts-proto and protobuf-es libraries - Include toProto function generation for protobuf-es 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for createOneofUnionTypeCode function - Test required and optional oneof unions - Test squashed oneof unions - Test imported oneof members - Support both ts-proto and protobuf-es libraries - Test different file layouts (proto_file vs graphql_type) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for createObjectTypeCode function - Test simple messages, nested fields, oneofs, empty messages - Support google-protobuf and protobufjs libraries - Include interface type generation - Test messages with GraphQL extensions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for createEnumTypeCode function - Test simple enums, enums without unspecified value - Test nested enums and enums with extensions - Support google-protobuf and protobufjs libraries 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for createInputObjectTypeCode function - Test simple inputs, nested fields, oneof fields, empty inputs - Test partial input types generation - Support google-protobuf and protobufjs libraries - Include toProto function generation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive tests for oneofUnionType code generation - Test simple oneof unions (required and optional) - Test squashed unions from import_squashed_union edge case - Cover both google-protobuf and protobufjs libraries - Generate snapshots for expected output validation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…egistry - Use getTestapisFileDescriptorSet and createFileRegistry directly - Create ObjectType directly from descriptor message - Remove plugin wrapper and global variable hack - Change packageName type to TestapisPackage for type safety - Fix test case to use correct message name 'PrefixedMessage' 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…istry - Use getTestapisFileDescriptorSet and createFileRegistry directly - Create EnumType directly from descriptor enum - Remove plugin wrapper and global variable hack - Change packageName type to TestapisPackage for type safety - Add special handling for nested enums and package name differences - Fix test case to use correct enum name 'PrefixedEnum' 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…n approach - Use buildCodeGeneratorRequest and plugin to get proper Schema context - Remove direct registry usage as InputObjectType requires Schema context - Change packageName type to TestapisPackage for type safety - Add partialInputs parameter to support partial input testing - Simplify partial input test case Note: This is a temporary solution. A better approach would be to construct InputObjectType directly from descriptors, but that requires more investigation into the Schema/File context requirements. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use buildCodeGeneratorRequest and createEcmaScriptPlugin - Change packageName type to TestapisPackage for type safety - Remove unnecessary plugin wrapper and global variable hack - Keep special handling for import_oneof_member_from_other_file edge case 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…gistry - Use getTestapisFileDescriptorSet and createFileRegistry directly - Create ObjectType directly from descriptor message - Remove plugin wrapper and global variable hack - Change packageName type to TestapisPackage for type safety - Fix test case to use correct message name 'PrefixedMessage' - Remove ts-proto support as nexus doesn't support it 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…stry - Use getTestapisFileDescriptorSet and createFileRegistry directly - Create EnumType directly from descriptor enum - Remove plugin wrapper and global variable hack - Change packageName type to TestapisPackage for type safety - Add special handling for nested enums and package name differences - Fix test case to use correct enum name 'PrefixedEnum' - Remove protobuf parameter from helper function 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
… approach - Use buildCodeGeneratorRequest and plugin to get proper Schema context - Change packageName type to TestapisPackage for type safety - Add partialInputs parameter to support partial input testing - Simplify partial input test case - Remove unnecessary plugin wrapper for partial inputs test Note: Similar to pothos, this uses the plugin approach as InputObjectType requires Schema context for proper type creation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use buildCodeGeneratorRequest and createEcmaScriptPlugin - Change packageName type to TestapisPackage for type safety - Remove unnecessary plugin wrapper and global variable hack - Keep special handling for import_squashed_union.pkg1 edge case 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ect message construction - Create InputObjectType directly from descriptor message - Remove plugin wrapper completely and use registry directly - Use inputType.toPartialInput() for partial inputs - Rename parameter to typeNameInProto to clarify proto message name usage - Update test cases to use actual proto message names instead of GraphQL type names 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ct message construction - Create InputObjectType directly from descriptor message - Remove plugin wrapper completely and use registry directly - Use inputType.toPartialInput() for partial inputs - Rename parameter to typeNameInProto to clarify proto message name usage - Update test cases to use actual proto message names instead of GraphQL type names 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ct descriptor construction - Create OneofUnionType directly from descriptor oneof field - Create SquashedOneofUnionType directly from descriptor message - Remove plugin wrapper completely and use registry directly - Add explicit oneofFieldName parameter for clarity - Split into two functions for regular and squashed unions - Update test cases to use actual proto message and field names 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…t descriptor construction - Replace plugin wrapper approach with getTestapisFileDescriptorSet and createFileRegistry - Create OneofUnionType directly from descriptor oneof field - Add explicit oneofFieldName parameter to generateOneofUnionTypeCode - Split generation logic into generateOneofUnionTypeCode and generateSquashedOneofUnionTypeCode - Update test calls to use proto message names (OneofParent) and oneof field names 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…n in enumType test - Change parameter name from enumTypeName to enumTypeNameInProto for clarity - Use dot notation for nested enums (e.g., ParentMessage.NestedEnum) - Simplify enum lookup logic to directly use proto names - Add special handling for testapi.enums package name discrepancy 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
… in enumType test - Change parameter name from enumTypeName to enumTypeNameInProto for clarity - Use dot notation for nested enums (e.g., ParentMessage.NestedEnum) - Simplify enum lookup logic to directly use proto names - Add special handling for testapi.enums package name discrepancy 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
- Apply consistent parameterized test pattern across all printer tests - Use declarative test case structure with TestCase and TestSuite types - Replace repetitive test code with test.each() for better maintainability - Update all test snapshots to match new test names - Improve code organization and reduce duplication This refactoring makes it easier to add new test cases and maintain existing ones by using a single test implementation that iterates over test configurations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
This PR adds comprehensive snapshot tests for the printer functions in both protoc-gen-pothos and protoc-gen-nexus packages, ensuring code generation quality and consistency.
What's Changed
Test Coverage
Benefits
🤖 Generated with Claude Code