Skip to content

fix types in tests#34

Merged
nicknisi merged 1 commit intomainfrom
nicknisi/fix-types
Dec 17, 2025
Merged

fix types in tests#34
nicknisi merged 1 commit intomainfrom
nicknisi/fix-types

Conversation

@nicknisi
Copy link
Member

These are cuasing build errors

@greptile-apps
Copy link

greptile-apps bot commented Dec 17, 2025

Greptile Summary

Fixed TypeScript type errors in test files that were causing build failures.

Changes made:

  • In src/server/actions.spec.ts: Removed invalid { data: {} } argument from getAuthAction() calls, as this function is a GET endpoint that accepts no parameters
  • In src/client/AuthKitProvider.spec.tsx: Replaced the deprecated pattern of using delete window.location with TypeScript-safe Object.defineProperty() to properly mock window.location in tests

Both changes align the test code with strict TypeScript type checking and modern JavaScript practices.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Both changes are straightforward type fixes in test files only, with no impact on production code. The fixes correctly align test code with actual function signatures and modern TypeScript practices.
  • No files require special attention

Important Files Changed

Filename Overview
src/client/AuthKitProvider.spec.tsx Replaced deprecated delete window.location pattern with Object.defineProperty to properly mock window.location in tests
src/server/actions.spec.ts Removed incorrect { data: {} } parameter from getAuthAction() calls to match function signature that takes no parameters

Sequence Diagram

sequenceDiagram
    participant Test as Test Suite
    participant Mock as Mock Setup
    participant Action as getAuthAction
    participant Context as AuthKit Context
    
    Note over Test,Context: actions.spec.ts - Function Call Fix
    Test->>Mock: Setup mockAuthContext
    Test->>Action: getAuthAction()
    Note right of Action: No parameters (GET request)
    Action->>Context: getRawAuthFromContext()
    Context-->>Action: auth data
    Action-->>Test: sanitized user info
    
    Note over Test,Context: AuthKitProvider.spec.tsx - Window Mock Fix
    Test->>Mock: Object.defineProperty(window, 'location', {...})
    Note right of Mock: Proper TypeScript-safe mocking
    Test->>Action: signOut({returnTo: '/home'})
    Action-->>Mock: window.location.href = 'https://auth.workos.com/logout'
    Test->>Mock: Object.defineProperty(window, 'location', {value: originalLocation})
    Note right of Mock: Restore original location
Loading

Copy link

@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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nicknisi nicknisi merged commit 710d3b8 into main Dec 17, 2025
6 checks passed
@nicknisi nicknisi mentioned this pull request Dec 18, 2025
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.

3 participants