looker-open-source / components

Looker's UI Components, Design Infrastructure and more
https://components.looker.com
MIT License
62 stars 31 forks source link

chore: Jest mock consistency #2904

Closed mdodgelooker closed 3 years ago

mdodgelooker commented 3 years ago
  1. Match the requestAnimationFrame mock in jest setup with that in the core product.
  2. Fix paddingSpy in useScrollLock.spec.tsx – not sure why it was working before but the core product wasn't having it.

I removed all existing instances of jest.spyOn(window, 'requestAnimationFrame'), since they are now redundant, except for two in Combobox.spec and Select.spec. Those will take some time to unwind so I want to save them for a follow-up (I created a ticket). In most cases an additional runTimers() call was necessary since the requestAnimationFrame mock uses a setTimeout.

github-actions[bot] commented 3 years ago

Coverage report

Total coverage

Status Category Percentage Covered / Total
🟒 Statements 94.74% 7332/7739
🟑 Branches 87.05% 4666/5360
🟒 Functions 93.49% 2112/2259
🟒 Lines 95.31% 7090/7439

Status of coverage: 🟒 - ok, 🟑 - slightly more than threshold, πŸ”΄ - under the threshold

Show files with reduced coverage πŸ”» ### Reduced coverage | Status | Filename | Statements | Branches | Functions | Lines | | :----: | :--------------------------------------------------------- | :---------------- | :----------------- | :----------------- | :---------------- | | 🟒 | components/src/utils/useHovered.ts | 100% | 83.33% (-8.33% πŸ”») | 100% | 100% | | 🟑 | components/src/Form/Inputs/Combobox/ComboboxMultiInput.tsx | 87.5% (-1.56% πŸ”») | 76.6% | 86.67% (-6.67% πŸ”») | 87.5% (-1.56% πŸ”») | > Status of coverage: 🟒 - ok, 🟑 - slightly more than threshold, πŸ”΄ - under the threshold

Report generated by πŸ§ͺjest coverage report action from 9776ac334b4377ae0b342f18c4ec259740b1b4c8

mdodgelooker commented 3 years ago

Oops sorry @lukelooker I thought I was sneaking that 2nd commit in before you saw this.