docs: rename packages (#9618)

This commit is contained in:
Shahed Nasser
2024-10-18 17:43:46 +03:00
committed by GitHub
parent 30659b077a
commit 61e6a07b55
16 changed files with 47 additions and 47 deletions

View File

@@ -41,7 +41,7 @@ export const getHighlights = [
]
```ts title="integration-tests/http/custom-routes.spec.ts" highlights={getHighlights}
import { medusaIntegrationTestRunner } from "medusa-test-utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
medusaIntegrationTestRunner({
testSuite: ({ api, getContainer }) => {

View File

@@ -19,7 +19,7 @@ In this chapter, you'll learn about the `medusaIntegrationTestRunner` utility fu
## 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.
The `medusaIntegrationTestRunner` utility function is provided by the `@medusajs/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.
For example:
@@ -29,7 +29,7 @@ export const highlights = [
]
```ts title="integration-tests/http/test.spec.ts" highlights={highlights}
import { medusaIntegrationTestRunner } from "medusa-test-utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
medusaIntegrationTestRunner({
testSuite: ({ api, getContainer }) => {

View File

@@ -46,7 +46,7 @@ export const helloWorldWorkflow = createWorkflow(
To write a test for this workflow, create the file `integration-tests/http/workflow.spec.ts` with the following content:
```ts title="integration-tests/http/workflow.spec.ts"
import { medusaIntegrationTestRunner } from "medusa-test-utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { helloWorldWorkflow } from "../../src/workflows/hello-world"
medusaIntegrationTestRunner({

View File

@@ -39,7 +39,7 @@ export default HelloModuleService
To create an integration test for the method, create the file `src/modules/hello/__tests__/service.spec.ts` with the following content:
```ts title="src/modules/hello/__tests__/service.spec.ts"
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
import { HELLO_MODULE } from ".."
import HelloModuleService from "../service"
import MyCustom from "../models/my-custom"

View File

@@ -19,12 +19,12 @@ In this chapter, you'll learn about the `moduleIntegrationTestRunner` utility fu
## moduleIntegrationTestRunner Utility
The `moduleIntegrationTestRunner` utility function is provided by the `medusa-test-utils` package to create integration tests for a module. The integration tests run on a test Medusa application with only the specified module enabled.
The `moduleIntegrationTestRunner` utility function is provided by the `@medusajs/test-utils` package to create integration tests for a module. The integration tests run on a test Medusa application with only the specified module enabled.
For example, assuming you have a `hello` module, create a test file at `src/modules/hello/__tests__/service.spec.ts`:
```ts title="src/modules/hello/__tests__/service.spec.ts"
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
import { HELLO_MODULE } from ".."
import HelloModuleService from "../service"
import MyCustom from "../models/my-custom"
@@ -83,7 +83,7 @@ If your module accepts options, you can set them using the `moduleOptions` prope
For example:
```ts
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
import HelloModuleService from "../service"
moduleIntegrationTestRunner<HelloModuleService>({
@@ -103,7 +103,7 @@ If your module doesn't have a data model, pass a dummy model in the `moduleModel
For example:
```ts
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
import HelloModuleService from "../service"
import { model } from "@medusajs/framework/utils"

View File

@@ -6,23 +6,23 @@ export const metadata = {
In this chapter, you'll learn about Medusa's testing tools and how to install and configure them.
## medusa-test-utils Package
## @medusajs/test-utils Package
Medusa provides a `medusa-test-utils` package with utility tools to create integration tests for your custom API routes, modules, or other Medusa customizations.
Medusa provides a `@medusajs/test-utils` package with utility tools to create integration tests for your custom API routes, modules, or other Medusa customizations.
### Install medusa-test-utils
### Install @medusajs/test-utils
To use the `medusa-test-utils` package, install it as a `devDependency`:
To use the `@medusajs/test-utils` package, install it as a `devDependency`:
```bash npm2yarn
npm install --save-dev medusa-test-utils@rc
npm install --save-dev @medusajs/test-utils@rc
```
---
## Install and Configure Jest
Writing tests with `medusa-test-utils`'s tools requires installing and configuring Jest in your project.
Writing tests with `@medusajs/test-utils`'s tools requires installing and configuring Jest in your project.
{/* TODO remove this note at some point in the future */}
@@ -100,4 +100,4 @@ Medusa provides utility tools for integration tests only. You can write unit tes
## Test Tools and Writing Tests
The next chapters explain how to use the testing tools provided by `medusa-test-utils` to write tests.
The next chapters explain how to use the testing tools provided by `@medusajs/test-utils` to write tests.