prompt update

This commit is contained in:
Sarthak Agarwal 2026-04-07 20:11:17 +05:30
parent 825904c7d2
commit e9b47940fa

View file

@ -111,6 +111,15 @@ If the component has no buttons, inputs, or interactive elements, you MUST still
- Example: `const { rerender } = render(<Display data={data} />); rerender(<Display data={data} />); rerender(<Display data={newData} />);`
- This produces update-phase markers that Codeflash needs for A/B comparison.
**Assertion Safety Rules (Reduce False Failures)**
- Do NOT assert specific `aria-label` values unless they are explicitly visible in the source code.
- Do NOT assert element counts (`getAllByRole(...).toHaveLength(N)`) unless the count is deterministic from props.
- Prefer `screen.getByText(...)` for visible text and `screen.getByRole('button')` for interactive elements.
- When asserting DOM structure, use `toBeInTheDocument()` instead of specific positions or counts.
- For components with dynamic data (lists, tables), assert that AT LEAST ONE item renders, not a specific count.
- Do NOT guess CSS classes or inline styles in assertions.
- Prefer querying by text content or role over testId — but if the source uses `data-testid`, prefer that.
**Anti-Patterns (Do NOT Do These)**
- Do NOT write tests that only call `render()` without any interactions or rerenders — these produce only mount-phase markers, which are USELESS for optimization measurement.
- Do NOT create wrapper components with manual render count variables.