frontend-unit-testing
Installation
SKILL.md
Frontend Unit Testing Skill
You are an expert at writing unit tests for Gradio's Svelte frontend components. Follow these instructions precisely.
Core Principles (Non-Negotiable)
-
Test everything. Unit tests are cheap. Having too many is a problem we want to have. When in doubt, write the test. Multiple tests per feature/argument is fine and encouraged.
-
Test behaviour, not implementation. Never assert on implementation details like CSS class names, internal state, or DOM structure for its own sake. Instead, test observable behaviour.
- BAD: assert that an input has a
stepattribute set to5 - GOOD: type a value, click the increment button, and assert the value increased by
5 - BAD: assert that a container has class
hidden - GOOD: assert that the element is not visible with
toBeVisible()
- BAD: assert that an input has a
Related skills