-
Notifications
You must be signed in to change notification settings - Fork 386
[test] Add component test for image compare widget #5549
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
[test] Add component test for image compare widget #5549
Conversation
🎭 Playwright Test Results✅ All tests passed! ⏰ Completed at: 09/16/2025, 09:34:02 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
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.
I like tests, but a lot of these feel pretty duplicative. Are they really testing different logic or code paths in ways that would provide a clear signal in case of failure?
|
||
import WidgetImageCompare from './WidgetImageCompare.vue' | ||
|
||
interface ImageCompareValue { |
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.
Is this interface available in the component itself?
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.
Exported the ImageCompareValue
interface directly from the component and updated the test to import it instead of duplicating - see commit 63d6a61
describe('WidgetImageCompare Display', () => { | ||
const createMockWidget = ( | ||
value: ImageCompareValue | string, | ||
options: Partial<ImageCompareProps> = {} |
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.
options: Partial<ImageCompareProps> = {} | |
options: SimplifiedWidget['options'] = {} |
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.
Changed Partial<ImageCompareProps>
to SimplifiedWidget['options']
for consistency with the actual component interface - see commit 63d6a61
}) | ||
|
||
it('handles empty object value', () => { | ||
const value = {} as ImageCompareValue |
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.
Can you type the variable?
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.
Added proper typing for the empty object test case - see commit 63d6a61
…g - addresses review feedback - Export ImageCompareValue interface from component for reuse - Update test to import interface instead of duplicating it - Replace Partial<ImageCompareProps> with SimplifiedWidget['options'] for consistency - Add proper typing for empty object test case Co-authored-by: DrJKL <[email protected]>
Reduced test duplication by consolidating similar test cases: - Combined 3 basic rendering tests into comprehensive structure test - Merged alt text tests into single parameterized test - Consolidated URL handling tests (long URLs, special chars, data/blob URLs) - Unified template structure verification into single test Reduces test count from 25 to 15 while maintaining full coverage. Provides clearer failure signals by grouping related assertions. Co-authored-by: DrJKL <[email protected]>
Consolidated overlapping tests from 25 to 15 tests, maintaining full coverage while providing clearer failure signals - see commit 87cb782 |
## Summary Added comprehensive component test suite for WidgetImageCompare widget with 410 test assertions covering display, edge cases, and integration scenarios. ## Changes - **What**: Created [Vue Test Utils](https://vue-test-utils.vuejs.org/) test suite for [WidgetImageCompare component](src/renderer/extensions/vueNodes/widgets/components/WidgetImageCompare.vue) using [Vitest](https://vitest.dev/) testing framework ## Review Focus Test coverage completeness for string vs object value handling, accessibility attribute propagation, and edge case robustness including malformed URLs and empty states. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5549-test-Add-component-test-for-image-compare-widget-26e6d73d365081189fe0d010f87d1eec) by [Unito](https://www.unito.io) --------- Co-authored-by: DrJKL <[email protected]>
Summary
Added comprehensive component test suite for WidgetImageCompare widget with 410 test assertions covering display, edge cases, and integration scenarios.
Changes
Review Focus
Test coverage completeness for string vs object value handling, accessibility attribute propagation, and edge case robustness including malformed URLs and empty states.
┆Issue is synchronized with this Notion page by Unito