Address empty methods in ```ResizeObserver``` mock in ```jest.setup.ts```
- Dominant language
- Python
- Stars
- 451
- Forks
- 707
- Avg merge
- 22h 59m
- Merged PRs (30d)
- 91
Description
***Description:***
The current mock implementation of ```ResizeObserver``` in ```frontend/jest.setup.ts``` contains empty methods for ```disconnect()```, ```observe()```, and ```unobserve()```. This triggers static analysis warnings (e.g., SonarQube typescript:S1186) because empty functions are indistinguishable from unintentional omissions.
While these methods are intentionally empty for the JSDOM environment, they should be documented or implemented as mocks to improve maintainability and clear the linting errors.
***To Reproduce Steps to reproduce the behavior:***
1. Open the file ```frontend/jest.setup.ts.```
2. Navigate to line 83.
3. Observe the ```globalThis.ResizeObserver``` class implementation.
4. Run a static analysis scan (like SonarQube) or a linting check that includes rule S1186.
5. See the warning: "```Unexpected empty method 'disconnect'```" and "```Unexpected empty method 'observe'```".
Expected behavior Methods in mocks should either contain a comment explaining why they are empty or be implemented using jest.fn() to explicitly signal that the no-op behavior is intentional and to provide better spy capabilities for testing.
***Are you going to work on fixing this?***
- [x] Yes
- [ ] No
***Screenshots***:
1.
2.
***Additional context***
I plan to fix this by replacing the empty method declarations with ```jest.fn()``` assignments. This not only silences the linter but also allows future tests to track calls to these methods (e.g., expect```(observer.disconnect).toHaveBeenCalled())```, which is a best practice for Jest mocks.
https://sonarcloud.io/project/issues?impactSeverities=HIGH&issueStatuses=OPEN%2CCONFIRMED&id=OWASP_Nest&open=AZXKHdktuTaF4N69SEgr&tab=code
hi @arkid15r @kasya
I want to work on this as this is a ```good first issue```. I want you to assign me for this issue
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.