Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 8, 2025

This PR completely rewrites the test fixtures in src/__tests__/fixtures.ts to use the type builder (t) instead of the schema builder (s), providing realistic schemas that cover all JSON Type node types.

Changes Made

Replaced old schema-based fixtures with type-based realistic schemas:

  • User profile schema - Demonstrates nested objects and optional fields using t.object() and .opt()
  • Product catalog - Shows arrays, formatted numbers, and optional properties
  • Blog post - Illustrates timestamps, enums, and cross-references
  • API response - Features discriminated unions for success/error states
  • File metadata - Includes binary data handling
  • Configuration - Demonstrates maps and environment-specific settings
  • Event data - Uses tuples for coordinates and complex metadata
  • Contact info - Shows arrays of tuples and formatted strings
  • Database records - Illustrates audit fields and references
  • Function types - Covers both regular and streaming functions
  • Complex nested structures - Deep nesting with maps and unions

Node Type Coverage

All JSON Type node types are now represented:

  • any - Flexible data fields
  • const - Literal values and enums
  • boolean - Feature flags and status indicators
  • number - Various formats (u16, u32, u64, f64) with constraints
  • string - ASCII format with length validation
  • binary - File data with type information
  • array - Collections with size constraints
  • tuple - Fixed-length structured data
  • object - Complex nested structures
  • map - Dynamic key-value collections
  • union/or - Discriminated unions and flexible types
  • ref - Cross-schema references
  • function - Validation and processing functions
  • streaming function - Real-time data streams

Backward Compatibility

Maintains compatibility with existing tests by providing the original primitiveSchemas, compositeSchemas, allSchemas, and schemaCategories exports that convert the new type-based fixtures to schemas using .getSchema().

The new fixtures provide more realistic and comprehensive examples while ensuring all tests continue to pass without modification.

Fixes #44.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Copilot AI changed the title [WIP] Test fixtures feat: implement comprehensive test fixtures using type builder Aug 8, 2025
Copilot AI requested a review from streamich August 8, 2025 16:37
@streamich
Copy link
Collaborator

Leave existing schemas defined with s as-is. Only add new schemas with t, do not modify existing ones.

Copy link
Collaborator

@streamich streamich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert changes to existing schemas with s, leave them as they were before.

@streamich streamich marked this pull request as ready for review August 8, 2025 22:38
@streamich streamich merged commit 8506c1f into master Aug 8, 2025
2 checks passed
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@streamich streamich deleted the copilot/fix-44 branch August 8, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test fixtures

2 participants