ccsync icon indicating copy to clipboard operation
ccsync copied to clipboard

Add Test Coverage for hooks.ts

Open Rustix69 opened this issue 11 months ago • 2 comments

Add Test Coverage for hooks.ts

Is your feature request related to a problem? Please describe.

The file frontend/src/components/HomeComponents/Tasks/hooks.ts has 0% test coverage (0/30 lines, 0/5 functions, 0/10 branches). This file contains critical functions for task management including fetching, adding, editing, and modifying tasks on the backend, as well as the TasksDatabase class.

Describe the solution you'd like

Add unit tests for all 5 exported functions in hooks.ts to achieve at least 80% coverage. Tests should cover successful API calls, error handling, conditional field inclusion, and the Dexie database initialization.

Describe alternatives you've considered

Testing only at the component level would provide some coverage but wouldn't isolate bugs in these utility functions. Integration tests alone wouldn't catch edge cases in request formatting and error handling.

Additional context

File location: frontend/src/components/HomeComponents/Tasks/hooks.ts

Other utilities in the same module have good coverage (tasks-utils.ts: 93.5%, report-download-utils.ts: 100%), making this the only untested file.

Rustix69 avatar Dec 31 '25 17:12 Rustix69

@its-me-abhishek Should I workk on this in last PR i had added teh test cases for the reports and tasks

Rustix69 avatar Dec 31 '25 17:12 Rustix69

sure @Rustix69

its-me-abhishek avatar Jan 01 '26 04:01 its-me-abhishek