docs: add prerequisites link for test guides (#9057)

- Add a prerequisites link to test guides pointing to how to setup the testing tools
- Add in the main http / module integration guides the command to run the tests
This commit is contained in:
Shahed Nasser
2024-09-09 13:58:42 +00:00
committed by GitHub
parent 2189ff2dc8
commit c091cf5868
5 changed files with 96 additions and 3 deletions
@@ -1,3 +1,5 @@
import { Prerequisites } from "docs-ui"
export const metadata = {
title: `${pageNumber} Write Integration Tests`,
}
@@ -6,6 +8,15 @@ export const metadata = {
In this chapter, you'll learn about the `medusaIntegrationTestRunner` utility function used to write integration tests.
<Prerequisites
items={[
{
text: "Testing Tools Setup",
link: "/debugging-and-testing/testing-tools"
}
]}
/>
## medusaIntegrationTestRunner Utility
The `medusaIntegrationTestRunner` utility function is provided by the `medusa-test-utils` package to create integration tests in your Medusa project. It runs a full Medusa application, allowing you test API routes, workflows, or other customizations.
@@ -39,7 +50,27 @@ The `medusaIntegrationTestRunner` function accepts an object as a parameter. The
The tests in the `testSuite` function are written using [Jest](https://jestjs.io/).
### Other Options and Inputs
---
### Run Tests
Run the following command to run your tests:
```bash npm2yarn
npm run test:integration
```
<Note title="Tip">
If you don't have a `test:integration` script in `package.json`, refer to the [Medusa Testing Tools chapter](../page.mdx#add-test-commands).
</Note>
This runs your Medusa application and runs the tests available under the `src/integrations/http` directory.
---
## Other Options and Inputs
Refer to [this reference in the Learning Resources documentation](!resources!/test-tools-reference/medusaIntegrationTestRunner) for other available parameter options and inputs of the `testSuite` function.