-
Notifications
You must be signed in to change notification settings - Fork 83
[FSSDK-12097] refactor OptimizelyUserContext tests using TS and vitest #1114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the OptimizelyUserContext test suite from JavaScript (using Chai/Sinon) to TypeScript with vitest. The refactoring modernizes the test infrastructure while maintaining comprehensive test coverage for user context functionality including attribute management, decision-making, forced decisions, and segment qualification.
Key Changes
- Migrated from Chai assertions to vitest's
expectAPI - Replaced Sinon mocks with vitest's
vi.fn()mocking utilities - Updated mock helpers to use TypeScript types and standardized mock functions (
getMockLogger,getMockEventDispatcher) - Removed deprecated parameters (
shouldIdentifyUser,isValidInstance,eventBatchSize) that are no longer part of the API
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
junaed-optimizely
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! For completeness, we can add tests for the async variants as well.
Summary
Test plan
Issues