Skip to content

Add comprehensive type compatibility tests for SDK #665

@nickna

Description

@nickna

Overview

Part of #658 - Add comprehensive tests to ensure type compatibility between manual definitions and generated types.

Dependencies

Scope

Create a comprehensive test suite that:

  1. Validates all refactored types remain compatible
  2. Catches any future drift between manual and generated types
  3. Provides clear error messages when types diverge
  4. Runs as part of CI/CD pipeline

Test Coverage Needed

Per-Type Tests

For each refactored type, create tests that verify:

  • Type structure matches
  • Optional properties align
  • Nested types are compatible
  • Enum values match

Integration Tests

  • Service methods accept generated types
  • Return types are assignable
  • WebUI can consume SDK types

Example Test Structure

// src/__tests__/types/provider.type.test.ts
describe('Provider Type Compatibility', () => {
  it('ProviderCredentialDto should match generated type', () => {
    // Type-level test that fails at compile time if types don't match
    const test: AssertEqual<
      ManualProviderCredentialDto,
      GeneratedProviderCredentialDto
    > = true;
  });

  it('should handle optional properties correctly', () => {
    // Runtime test for optional property handling
  });
});

Implementation Steps

  1. Set up test infrastructure
  2. Create test utilities for type comparison
  3. Add tests for each type group:
  4. Add tests to CI/CD pipeline
  5. Document how to add new tests

Success Metrics

  • 100% coverage of refactored types
  • Tests catch breaking changes
  • CI/CD fails on type mismatches
  • Clear error messages guide fixes
  • < 30 second test execution time

Definition of Done

  • All refactored types have tests
  • Tests integrated into CI/CD
  • Documentation complete
  • Team trained on maintaining tests
  • PR reviewed and merged

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions