Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
riqwan committed Sep 2, 2024
1 parent 30b18d6 commit 886a006
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 293 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ medusaIntegrationTestRunner({
.catch((e) => e)

expect(e.response.data.message).toEqual(
"amount to refund cannot be greater than pending difference - 75"
"Cannot refund more than pending difference - 75"
)
})

Expand Down
35 changes: 34 additions & 1 deletion integration-tests/http/__tests__/region/admin/region.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ContainerRegistrationKeys, Modules } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "medusa-test-utils"
import {
adminHeaders,
Expand All @@ -10,9 +11,10 @@ medusaIntegrationTestRunner({
testSuite: ({ dbConnection, getContainer, api }) => {
let region1
let region2
let container

beforeEach(async () => {
const container = getContainer()
container = getContainer()
await createAdminUser(dbConnection, adminHeaders, container)

region1 = (
Expand Down Expand Up @@ -102,6 +104,37 @@ medusaIntegrationTestRunner({
)
})
})

it("should list payment providers", async () => {
const remoteLink = container.resolve(
ContainerRegistrationKeys.REMOTE_LINK
)

let response = await api.get(
`/store/regions/${region1.id}?fields=*payment_providers`
)

expect(response.status).toEqual(200)
expect(response.data.region.payment_providers).toEqual([])

await remoteLink.create([
{
[Modules.REGION]: { region_id: region1.id },
[Modules.PAYMENT]: { payment_provider_id: "pp_system_default" },
},
])

response = await api.get(
`/store/regions/${region1.id}?fields=*payment_providers`
)

expect(response.status).toEqual(200)
expect(response.data.region.payment_providers).toEqual([
expect.objectContaining({
id: "pp_system_default",
}),
])
})
})

describe("POST /admin/regions", () => {
Expand Down
9 changes: 5 additions & 4 deletions integration-tests/modules/__tests__/order/order.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
ICartModuleService,
IFulfillmentModuleService,
IInventoryServiceNext,
IInventoryService,
IOrderModuleService,
IPaymentModuleService,
IPricingModuleService,
IProductModuleService,
IRegionModuleService,
IStockLocationServiceNext,
IStockLocationService,
} from "@medusajs/types"
import {
ContainerRegistrationKeys,
Expand All @@ -32,8 +32,8 @@ medusaIntegrationTestRunner({
let productModule: IProductModuleService
let paymentModule: IPaymentModuleService
let pricingModule: IPricingModuleService
let inventoryModule: IInventoryServiceNext
let stockLocationModule: IStockLocationServiceNext
let inventoryModule: IInventoryService
let stockLocationModule: IStockLocationService
let fulfillmentModule: IFulfillmentModuleService
let orderModule: IOrderModuleService
let remoteLink, remoteQuery
Expand Down Expand Up @@ -138,6 +138,7 @@ medusaIntegrationTestRunner({
display_id: 1,
payment_collections: [],
payment_status: "not_paid",
region_id: "test_region_id",
fulfillments: [],
fulfillment_status: "not_fulfilled",
summary: expect.objectContaining({
Expand Down
287 changes: 0 additions & 287 deletions integration-tests/modules/__tests__/payment/payments.spec.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/medusa/src/api/admin/orders/query-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const defaultAdminOrderFields = [
export const defaultAdminRetrieveOrderFields = [
"id",
"display_id",
"region_id",
"status",
"version",
"summary",
Expand Down

0 comments on commit 886a006

Please sign in to comment.