Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit testing #17

Closed
ptgott opened this issue Nov 1, 2024 · 3 comments
Closed

Add unit testing #17

ptgott opened this issue Nov 1, 2024 · 3 comments

Comments

@ptgott
Copy link
Contributor

ptgott commented Nov 1, 2024

The legacy docs engine includes a unit test suite, which it runs using the following command:

loadr -- uvu uvu-tests

There hasn't been any development on loadr or uvu in a few years, so we should switch to an industry standard like Jest.

I propose we:

  • Copy the test suite from gravitational/docs
  • Convert the tests to use the Jest syntax
  • Get the tests to pass
  • Add a workflow to require the tests to pass on changes to docs-website
@ptgott
Copy link
Contributor Author

ptgott commented Nov 22, 2024

We can also consider adding the Storybook tests from gravitational/docs, adapt them to the new website, and run them with Jest as part of the test workflow.

@taraspos
Copy link
Contributor

@ptgott Amplify supports running cypress tests to run before deploying changes1. Might be good to add at least some sanity check to make sure application loads as expected.

Footnotes

  1. https://docs.aws.amazon.com/amplify/latest/userguide/running-tests.html

ptgott added a commit that referenced this issue Jan 29, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

To simplify things, use a single tsconfig.json for Jest as well as
plugins.

To get the `remark-includes` test to pass, edit the `updatePaths`
function to only extract a version number from the path of a partial if
the partial falls under a directory path for production content.
ptgott added a commit that referenced this issue Jan 29, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

To get the `remark-includes` test to pass, edit the `updatePaths`
function to only extract a version number from the path of a partial if
the partial falls under a directory path for production content.
ptgott added a commit that referenced this issue Jan 29, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

To get the `remark-includes` test to pass, edit the `updatePaths`
function to only extract a version number from the path of a partial if
the partial falls under a directory path for production content.
ptgott added a commit that referenced this issue Jan 30, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
ptgott added a commit that referenced this issue Jan 30, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
ptgott added a commit that referenced this issue Jan 30, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
ptgott added a commit that referenced this issue Jan 30, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
ptgott added a commit that referenced this issue Jan 30, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
ptgott added a commit that referenced this issue Jan 31, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
ptgott added a commit that referenced this issue Jan 31, 2025
See #17

Migrate unit tests for our custom remark and rehype plugins from the
archived `gravitational/docs` repo. Convert these tests to Jest, which
unlike the uvu testing tool we used for `gravitational/docs`, is still
being maintained. Add a GitHub Actions workflow to run the tests on pull
requests.

This change does not add tests for `remark-includes`, which requires
some changes to how the site processes link paths.
@ptgott
Copy link
Contributor Author

ptgott commented Feb 26, 2025

I am going to close this issue since we now have a unit test suite for server code. It's looking to be non-trivial to move our Storybook tests to Docusaurus, since there's no Storybook framework/addon that (a) supports Docusaurus's built-in webpack config and (b) is currently being maintained. I think we can cover that and any end-to-end testing needs in a separate issue if we want.

@ptgott ptgott closed this as completed Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants