chore: Move sales channel tests (#7579)

What
- Move sales channel integration tests from `/api` to `/http`

Deleted tests that do not belong in the suite:
- POST /admin/products/:id
   - Mutation sales channels on products
- POST /admin/products
   - Creating a product with a sales channel
- GET /admin/products
   - Filtering products by sales channel
   - Expanding with a sales channel
- GET /admin/orders
   - Filtering orders by sales channel
   - Expanding with a sales channel
- POST /admin/orders/:id/swaps
   - Creating a swap with a sales channel
This commit is contained in:
Oli Juhl
2024-06-03 11:47:45 +02:00
committed by GitHub
parent 65d3222973
commit cabdb2fcd8
3 changed files with 526 additions and 1296 deletions

View File

@@ -2,15 +2,16 @@ import {
deleteSalesChannelsWorkflow,
updateSalesChannelsWorkflow,
} from "@medusajs/core-flows"
import { MedusaError } from "@medusajs/utils"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "../../../../types/routing"
import { refetchSalesChannel } from "../helpers"
import {
AdminGetSalesChannelParamsType,
AdminUpdateSalesChannelType,
} from "../validators"
import { refetchSalesChannel } from "../helpers"
export const GET = async (
req: AuthenticatedMedusaRequest<AdminGetSalesChannelParamsType>,
@@ -22,6 +23,13 @@ export const GET = async (
req.remoteQueryConfig.fields
)
if (!salesChannel) {
throw new MedusaError(
MedusaError.Types.NOT_FOUND,
`Sales channel with id: ${req.params.id} not found`
)
}
res.json({ sales_channel: salesChannel })
}