Add UI Tests #6064

Closed
opened 2025-12-29 19:36:17 +01:00 by adam · 2 comments
Owner

Originally created by @thatmattlove on GitHub (Feb 8, 2022).

Originally assigned to: @thatmattlove on GitHub.

Proposed Changes

I'd like to start adding unit tests for UI code (TypeScript), with the intent of adding tests for as much as possible, beginning with utility functions.

Jest is the most common testing framework for JavaScript/TypeScript environments, and plays well with esbuild. As part of the implementation, the following would be added to devDependencies:

  1. jest
  2. esbuild-jest
  3. @testing-library/jest-dom
  4. @types/jest

Along with two basic Jest configuration files. From there, each .ts file that has accompanying tests would have a corresponding .test.ts file containing the tests.

A yarn test command would also be added.

We can also easily add the test workflow to the pre-commit script and CI actions to ensure all tests pass prior to merging changes.

I've begun work on this in the add-frontend-tests branch.

Justification

Code doesn't work without tests, right? RIGHT?

Originally created by @thatmattlove on GitHub (Feb 8, 2022). Originally assigned to: @thatmattlove on GitHub. ### Proposed Changes I'd like to start adding unit tests for UI code (TypeScript), with the intent of adding tests for as much as possible, beginning with utility functions. [Jest](https://jestjs.io/) is the most common testing framework for JavaScript/TypeScript environments, and plays well with esbuild. As part of the implementation, the following would be added to `devDependencies`: 1. `jest` 2. `esbuild-jest` 3. `@testing-library/jest-dom` 4. `@types/jest` Along with two basic Jest configuration files. From there, each `.ts` file that has accompanying tests would have a corresponding `.test.ts` file containing the tests. A `yarn test` command would also be added. We can also easily add the test workflow to the pre-commit script and CI actions to ensure all tests pass prior to merging changes. I've begun work on this in the `add-frontend-tests` branch. ### Justification Code doesn't work without tests, right? RIGHT?
adam added the pending closurestatus: under reviewtype: housekeeping labels 2025-12-29 19:36:17 +01:00
adam closed this issue 2025-12-29 19:36:17 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Apr 9, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Apr 9, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (May 9, 2022):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (May 9, 2022): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6064