rusackas opened a new pull request, #37887:
URL: https://github.com/apache/superset/pull/37887

   ## SUMMARY
   
   Add the `jest/expect-expect` rule to enforce that all Jest test blocks 
contain explicit assertions. This rule helps ensure tests actually verify 
behavior rather than just running code without checking results.
   
   ### Rule Configuration
   
   The rule is added to `oxlint.json` with:
   - Error level enforcement
   - Custom `assertFunctionNames` to recognize project-specific assertion 
helper functions:
     - `expect*` (glob pattern matching all expect-prefixed helpers like 
`expectDrillToDetailEnabled`, `expectElementsVisible`)
     - `runTimezoneTest` (time comparison test helper)
     - `compareURI` (explore utils test helper)
     - `test*WithInitialValues` (truncation hook test helper)
   
   ### Tests Fixed
   
   Fixed 11 tests that had implicit or missing assertions by adding explicit 
`expect()` calls:
   
   | File | Issue | Fix |
   |------|-------|-----|
   | `ModalTrigger.test.tsx` | `findByRole('tooltip')` implicit | Added 
`expect(...).toBeInTheDocument()` |
   | `ChartDataProvider.test.tsx` | `findByRole('status')` implicit | Added 
explicit assertion |
   | `SuperChart.test.tsx` | Skipped test still flagged | Added eslint-disable 
comment |
   | `Markdown.test.tsx` (x2) | Missing assertions | Added assertions for error 
handling and resize |
   | `UploadDataModal.test.tsx` | `waitFor` without expect | Added assertions 
inside waitFor |
   | `AnnotationLayerList.test.tsx` | `findByText` implicit | Added explicit 
assertion |
   | `CssTemplateList.test.tsx` | `findByText` implicit | Added explicit 
assertion |
   | `ChartCreation.test.tsx` (x2) | `findByText` implicit | Added explicit 
assertions |
   | `sqlLab.test.ts` | No assertion at all | Added assertion verifying empty 
refresh behavior |
   
   ## BEFORE/AFTER
   
   Before:
   ```typescript
   test('should render a tooltip on hover', async () => {
     render(<ModalTrigger {...tooltipProps} />);
     await userEvent.hover(screen.getByRole('button'));
     await screen.findByRole('tooltip');  // implicit assertion - will throw if 
not found
   });
   ```
   
   After:
   ```typescript
   test('should render a tooltip on hover', async () => {
     render(<ModalTrigger {...tooltipProps} />);
     await userEvent.hover(screen.getByRole('button'));
     expect(await screen.findByRole('tooltip')).toBeInTheDocument();  // 
explicit assertion
   });
   ```
   
   ## TESTING INSTRUCTIONS
   
   These are lint rule changes. CI will verify all linting passes.
   
   ## ADDITIONAL INFORMATION
   
   - Part of ongoing lint cleanup effort (batch 4)
   - Related PRs: #37883, #37884, #37885
   - The rule recognizes Cypress tests are excluded via `ignorePatterns` in 
oxlint.json
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to