Skip to content

chore: add more tests to survey manager #15

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

mattinannt
Copy link
Member

This pull request introduces changes to the SurveyManager class and its test coverage in the FormbricksSDK. The key updates include modifying access levels for methods, refactoring helper methods, and adding comprehensive test cases to improve code reliability and maintainability.

Changes to SurveyManager:

  • Updated method access levels from private to internal for refreshEnvironmentAfter, shouldDisplayBasedOnPercentage, and getLanguageCode to allow broader access within the module. [1] [2] [3]
  • Refactored helper methods by moving them from private extension SurveyManager to extension SurveyManager, making them accessible as part of the main class extension.

Test Coverage Enhancements:

  • Added a new test case, testSurveyManagerEdgeCases, in FormbricksSDKTests to cover edge scenarios for SurveyManager. This includes testing:
    • shouldDisplayBasedOnPercentage for various input values.
    • Handling of corrupt UserDefaults data.
    • Timer-based refresh functionality.
    • Comprehensive coverage of getLanguageCode with different language configurations.

Copy link

@mattinannt mattinannt merged commit b485152 into main May 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant