Skip to content

Fix test type errors#51

Merged
chaance merged 2 commits intomainfrom
chance/fix-test-type-errors
Dec 11, 2025
Merged

Fix test type errors#51
chaance merged 2 commits intomainfrom
chance/fix-test-type-errors

Conversation

@chaance
Copy link
Contributor

@chaance chaance commented Dec 11, 2025

No description provided.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 11, 2025

Greptile Overview

Greptile Summary

Fixed TypeScript compilation errors in test files caused by an updated @workos-inc/node package that added required locale and metadata fields to the User type.

  • Added missing locale: null and metadata: {} fields to all User mock objects across test files
  • Replaced type assertions (as User) with type satisfaction checks (satisfies User) for stricter compile-time validation
  • Created getMockLoaderFunctionArgs helper function to properly type LoaderFunctionArgs objects
  • Improved type safety by using type imports for User and LoaderFunctionArgs

These changes are purely type-related fixes in test code with no impact on runtime behavior or production code.

Confidence Score: 5/5

  • This PR is completely safe to merge with zero risk
  • All changes are isolated to test files, fixing TypeScript type errors without any logic changes. The improvements use stricter type checking (satisfies instead of as) which actually enhances type safety. No production code is affected.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/auth.spec.ts 5/5 Added missing locale and metadata fields to User objects, changed type assertions from as User to satisfies User for stricter type checking
src/authkit-callback-route.spec.ts 5/5 Added helper function getMockLoaderFunctionArgs for proper typing and replaced inline object literals with properly typed alternatives
src/session.spec.ts 5/5 Added missing User fields and improved LoaderFunctionArgs typing using type assertion
src/test-utils/test-helpers.ts 5/5 Added missing locale and metadata fields to mock User object in createAuthWithCodeResponse, changed to satisfies User for type safety

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant TS as TypeScript Compiler
    participant Tests as Test Suite
    participant User as User Type (@workos-inc/node)
    
    Dev->>Tests: Run tests with updated @workos-inc/node
    Tests->>TS: Compile test files
    TS->>User: Check User type definition
    User-->>TS: Requires locale and metadata fields
    TS-->>Dev: Type errors: missing fields
    
    Dev->>Tests: Add locale: null, metadata: {}
    Dev->>Tests: Change "as User" to "satisfies User"
    Dev->>Tests: Add getMockLoaderFunctionArgs helper
    Dev->>Tests: Properly type LoaderFunctionArgs
    
    Tests->>TS: Recompile with fixes
    TS->>User: Validate type conformance
    User-->>TS: All fields present, types match
    TS-->>Tests: Compilation successful
    Tests-->>Dev: All tests pass
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

request,
params: {},
context: {},
} as LoaderFunctionArgs)) as DataWithResponseInit<unknown>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

RR has added an unstable argument that we don't use internally, hence the type-casting.

@chaance chaance merged commit 9d5a368 into main Dec 11, 2025
9 checks passed
@chaance chaance deleted the chance/fix-test-type-errors branch December 11, 2025 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants