Skip to content

unit test cases fix#522

Closed
karancs06 wants to merge 13 commits intodevelop_v4from
unit-test-cases-fix
Closed

unit test cases fix#522
karancs06 wants to merge 13 commits intodevelop_v4from
unit-test-cases-fix

Conversation

@karancs06
Copy link
Copy Markdown
Contributor

fixing the unti test cases

@karancs06 karancs06 requested a review from a team as a code owner November 5, 2025 13:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 5, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 64.68% 2324 / 3593
🔵 Statements 63.58% 2359 / 3710
🔵 Functions 62.15% 427 / 687
🔵 Branches 56.36% 1249 / 2216
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
package.json 0% 0% 0% 0%
src/__test__/utils.ts 84.09% 81.81% 80% 83.72% 11, 28-31, 76-80, 100
Generated in workflow #612 for commit e15a1af by the Vitest Coverage Report Action

@karancs06 karancs06 changed the base branch from main to develop_v4 November 5, 2025 18:18
…entAddButton

- Add microtask wait for Preact component rendering in variant icon test
- Add microtask wait for button generation loops (5 buttons) to complete
- Fixes 2 remaining timeout failures

All tests now passing locally with optimized performance
- Added mock for getFieldVariantStatus() with correct BASE_VARIANT_STATUS structure
- Added mock for FIELD_LOCATION_DATA postMessage event to prevent hanging
- Fixed visualBuilderPostMessage.send() mock to handle all event types properly
- Reverted test timeout back to 30s (root cause was missing mocks, not timeout)
- Tests that were timing out at 30s+ now complete in 5-20s each
- All 813 tests passing locally in ~94 seconds
…eep() calls

- Removed 7 artificial delays (sleep(0) and setTimeout(0))
- Buttons are appended synchronously to DOM, no need to wait
- Test duration: 44s → 9s locally (80% improvement)
- Expected CI improvement: ~7 minutes saved (based on 13x slowdown factor)

Changes:
- Replaced 'await sleep(0)' with direct synchronous DOM queries
- Replaced 'await new Promise(resolve => setTimeout(resolve, 0))' with synchronous queries
- Added clarifying comments that buttons are appended synchronously

All 20 tests still pass. Optimization is safe and maintains test integrity.
@karancs06 karancs06 closed this Nov 21, 2025
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