Commit ea82434
authored
test: prevent next/image fill prop warnings in mocks (JhaSourav07#3198)
## Description
Fixes JhaSourav07#3197
This PR removes React warnings generated during test execution by
updating the mocked `next/image` implementation used throughout the test
suite.
### Problem
Several test files mocked `next/image` by forwarding all received props
directly to a native `<img>` element:
```tsx
<img {...props} />
```
When components rendered images using Next.js's `fill` prop:
```tsx
<Image fill />
```
the mock produced:
```tsx
<img fill={true} />
```
which caused React warnings during test execution:
```text
Warning: Received `true` for a non-boolean attribute `fill`.
```
While tests continued to pass, the warnings cluttered CI logs and made
it harder to identify legitimate issues.
### Fix
Updated the test mocks to remove the `fill` prop before forwarding
remaining props to the native `<img>` element:
```tsx
const { fill, ...rest } = props;
return <img {...rest} />;
```
### Files Updated
```text
page.test.tsx
page.responsive-breakpoints.test.tsx
page.empty-fallback.test.tsx
```
### Result
* Eliminates React DOM warnings during tests.
* Keeps CI output clean and easier to review.
* Better mirrors actual Next.js image behavior.
* Prevents invalid attributes from being rendered in mocked components.
## Pillar
* [ ] 🎨 Pillar 1 — New Theme Design
* [ ] 📐 Pillar 2 — Geometric SVG Improvement
* [ ] 🕐 Pillar 3 — Timezone Logic Optimization
* [x] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
N/A – Test-only change. No UI, SVG, or visual output modifications.
## Checklist before requesting a review:
* [x] I have read the `CONTRIBUTING.md` file.
* [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
* [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
* [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
* [ ] I have updated `README.md` if I added a new theme or URL
parameter. (Not applicable)
* [x] I have started the repo.
* [x] I have made sure that I have only one commit to merge in this PR.
* [x] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (No SVG changes in this PR).
* [ ] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.3 files changed
Lines changed: 17 additions & 5 deletions
File tree
- app
- contributors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
0 commit comments