mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
prompt update
This commit is contained in:
parent
825904c7d2
commit
e9b47940fa
1 changed files with 9 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue