-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
Add comprehensive unit tests for the TemplateHeuristics class to ensure proper sample data generation and profile creation for the capture system.
Work Required
- Create Test File: Add
test/capture.template-heuristics.test.js - Test getSampleData(): Verify sample data for all known templates
- Test generateProfile(): Test profile generation for different template patterns
- Test Fallbacks: Verify fallback behavior for unknown templates
- Mock Dependencies: Mock page objects where needed
Implementation Details
Based on capture/template-heuristics.js, test coverage for:
Sample Data Templates
animated-text: text, velocity parameterscarousel: items array, duration, zoom parametersmessage-banner: title, subtitlewebp-loop: url, fit parameterstimeleft: minutes, labelsnake: cellSize, tickMssimple-clock: empty object
Profile Generation Patterns
- Clock/time templates: wait for text with digits, timed screenshots
- Text/animation templates: wait for animation, longer video duration
- Carousel templates: wait for media and stability, extended recording
- Media templates: wait for media loading
- Game templates: wait for coverage and initialization
- Banner templates: wait for text, shorter videos
- Default templates: wait for visual stability
Test Cases
getSampleData()returns correct structure for known templatesgetSampleData()returns empty object{}for unknown templatesgenerateProfile()creates appropriate detection strategiesgenerateProfile()sets reasonable timeouts and durations- Pattern matching works for template ID variations
- Mock page analysis returns expected content structure
Files to Create
test/capture.template-heuristics.test.js- New test file
Acceptance Criteria
-
template-heuristics.jsstatements coverage reaches ≥50% - All template patterns are tested with expected sample data
- Profile generation logic is validated for each template type
- Edge cases and fallbacks are covered
- Tests use proper mocking for page objects
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels