-
-
Notifications
You must be signed in to change notification settings - Fork 511
wip claude js tests #6598
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
wip claude js tests #6598
Conversation
Fixes StandardJS linting errors: - 'MouseEvent' is not defined at lines 63 and 73 Added browser to eslint-env since the test uses jsdom which simulates a browser environment where MouseEvent is available as a global. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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 work-in-progress PR modernizes JavaScript test files by removing unnecessary jQuery DOM-ready callbacks and async done() patterns, adding comprehensive test coverage for previously untested modules, and improving test clarity.
Key Changes:
- Removed jQuery
$(() => {})callbacks and asyncdone()patterns from synchronous tests in validated_form.test.js and notifier.test.js - Added new test files for TypeChecker, time_zone, and read_more modules
- Improved test assertions by replacing
.toBeTruthy()with.toBe(true)for more precise boolean checks - Fixed misleading test description in case_emancipations.test.js
- Enhanced test coverage for convertDateToSystemTimeZone function in case_contact.test.js
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/javascript/tests/validated_form.test.js | Removed unnecessary jQuery callbacks and done() patterns from NonDrivingContactMediumWarning tests, making them synchronous |
| app/javascript/tests/type_checker.test.js | Added comprehensive test coverage for TypeChecker utility with edge cases for all validation methods |
| app/javascript/tests/two_minute_warning_session_timeout.test.js | Removed placeholder test that only verified module loading without meaningful assertions |
| app/javascript/tests/time_zone.test.js | Added new tests for findTimeZone function covering format validation and consistency |
| app/javascript/tests/read_more.test.js | Added comprehensive tests for read more/less toggle functionality including event handling and multiple instances |
| app/javascript/tests/notifier.test.js | Modernized tests by removing jQuery callbacks, switching to .toBe(true/false) for boolean assertions |
| app/javascript/tests/case_emancipations.test.js | Fixed test description to accurately reflect test behavior (expects '+' when closed, not '-') |
| app/javascript/tests/case_contact.test.js | Enhanced test coverage with additional test cases for date conversion including edge cases and invalid inputs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Timezone should be in format like "America/New_York" or "Europe/London" | ||
| // Common formats: Continent/City or UTC | ||
| expect(timezone).toMatch(/^[A-Za-z_]+\/[A-Za-z_]+$|^UTC$|^[A-Z]{3,4}$/) |
Copilot
AI
Nov 29, 2025
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.
This regex pattern may be too restrictive for all possible timezone formats returned by jstz. The pattern only matches:
- Continent/City format (e.g., "America/New_York")
- "UTC"
- 3-4 uppercase letters (e.g., "EST")
However, jstz can return other formats like "GMT", "GMT+1", "GMT-5", or other variations. Consider using a more flexible pattern or testing against a known list of valid IANA timezone names, or simply verify the string is non-empty since the implementation uses jstz which should always return valid values.
Example alternative:
expect(timezone).toMatch(/^[A-Za-z_0-9+\-\/]+$/)| expect(timezone).toMatch(/^[A-Za-z_]+\/[A-Za-z_]+$|^UTC$|^[A-Z]{3,4}$/) | |
| expect(timezone).toMatch(/^[A-Za-z_0-9+\-\/]+$/) |
new js specs