Add Tests for Custom Hooks (5/6)
- Dominant language
- No language data
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Split off from https://github.com/coder/coder/issues/11421
This covers a quarter of the miscellaneous hooks that we have littered throughout the codebase. Some of these might already have test coverage via other means, some might be better off getting deleted. Some might be simple, and others might be complicated. The only criteria for whether a hook should be in the list was that someone would be able to import them into another file. I'm less concerned with custom hooks used as internal implementation details
## Hook list
| Hook name | Filepath | Needs | Comments |
| --- | --- | --- | --- |
| useSingleSignOnSection | `./src/pages/UserSettingsPage/SecurityPage/SingleSignOnSection` | Tests | Used in three spots, but only in one file. Could probably be consolidated, in which case, the functionality would be covered by TemplateSchedulePage.test.tsx |
| useTokensData | `./src/pages/UserSettingsPage/TokensPage/hooks` | Tests | Only used in one file; could be consolidated. Would still need component test |
| useDeleteToken | `./src/pages/UserSettingsPage/TokensPage/hooks` | Tests | Only used in one file; could be consolidated. Would still need component test |
| useStatusFilterMenu | `./src/pages/UsersPage/UsersFilter` | Tests | Only used in one file; might already be covered by component test |
| useResourcesNav | `./src/pages/WorkspacesPage/useResourcesNav` | Has test | Used in several parts of the codebase; has a giant TODO comment. |
| useWorkspacesSettings | `./src/pages/WorkspacesSettingsPage/WorkspacesSettingsLayout` | Tests | Might already be covered by component test; used in several spots |
| useBatchActions | `./src/pages/WorkspacesPage/batchActions` | Tests | Looks like a complicated hook; definitely feels like it needs a test |
## Remaining tasks
- [ ] `useSingleSignOnSection`
- [ ] `useTokensData`
- [ ] `useDeleteToken`
- [ ] `useStatusFilterMenu`
- [ ] `useResourcesNav`
- [ ] `useWorkspacesSettings`
- [ ] `useBatchActions`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.