Skip to content

Conversation

@kendallstrautman
Copy link
Contributor

Description

This flakey assertion is causing CI to fail.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

Changed assertSame to assertEquals in two organization membership test methods to fix flaky CI failures.

  • The fixture returns arrays containing RoleResponse objects, while toArray() returns serialized arrays
  • assertSame requires strict identity (===), causing failures due to type mismatches
  • assertEquals properly compares values with type coercion, resolving the flakiness

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change correctly fixes a flaky test by switching from strict identity comparison (assertSame) to value equality comparison (assertEquals). This is the appropriate fix for comparing fixture data containing objects with serialized response data. The change is minimal, well-targeted, and resolves the CI failure without affecting test coverage or introducing any issues.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
tests/WorkOS/UserManagementTest.php 5/5 Changed assertSame to assertEquals in two test methods to fix flaky assertions caused by type mismatches between RoleResponse objects and arrays

Sequence Diagram

sequenceDiagram
    participant Test as UserManagementTest
    participant API as userManagement API
    participant Response as OrganizationMembershipResponse
    participant Fixture as organizationMembershipFixture()
    
    Test->>API: createOrganizationMembership(userId, orgId, null, null)
    API-->>Response: Returns response object
    Response->>Response: toArray() converts RoleResponse objects to arrays
    Test->>Fixture: Get expected fixture data (contains RoleResponse objects)
    Test->>Test: assertEquals(fixture, response.toArray())
    Note over Test: assertEquals allows type coercion<br/>Previously: assertSame required strict identity
    
    Test->>API: updateOrganizationMembership(id, null, null)
    API-->>Response: Returns response object  
    Response->>Response: toArray() converts RoleResponse objects to arrays
    Test->>Fixture: Get expected fixture data (contains RoleResponse objects)
    Test->>Test: assertEquals(fixture, response.toArray())
    Note over Test: Fixed flaky assertion by using<br/>value equality instead of identity check
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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@kendallstrautman kendallstrautman merged commit f31ec51 into main Dec 3, 2025
5 checks passed
@kendallstrautman kendallstrautman deleted the fix-test branch December 3, 2025 20:17
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