coder / coder/internal

Add Tests for Custom Hooks (6/6)

Open
#1,224 0 comments 0 reactions 0 assignees View on GitHub
site
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 |
| --- | --- | --- | --- |
| useCoderTheme | `./src/components/SyntaxHighlighter/coderTheme` | Tests (or could be inlined) | Very small hook used in one spot |
|useWorkspacesData | `./src/pages/WorkspacesPage/data` | Tests | Might already be covered by component test |
|useWorkspacesUpdate | `./src/pages/WorkspacesPage/data` | Tests | Might already be covered by component test |
| useTemplateFilterMenu | `./src/pages/WorkspacesPage/filter` | Tests | Complicated, but only used in one spot. Could be consolidated and be covered by component test |
| useStatusFilterMenu | `./src/pages/WorkspacesPage/filter` | Tests | Complicated, but only used in one spot. Could be consolidated and be covered by component test |
| useDeploymentOptions | `./src/pages/utils/deployOptions` | Delete | This is just a useMemo wrapper over the deploymentOptions function, but the function likely isn't doing enough or has enough data that it's needed |
| useValidationSchemaForRichParameters | `./src/pages/utils/richParameters` | Tests | Very long and complicated. Its file has tests, but none are for this function |

## Remaining tasks
- [ ] `useCoderTheme`
- [ ] `useWorkspacesData`
- [ ] `useWorkspacesUpdate`
- [ ] `useTemplateFilterMenu`
- [ ] `useStatusFilterMenu`
- [ ] `useDeploymentOptions`
- [ ] `useValidationSchemaForRichParameters`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.