feat(core-flows,medusa): Add API to update cart's customer (#10151)
what: - adds an endpoint that updates a cart's customer RESOLVES CMRC-718
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import { ICustomerModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import {
|
||||
generatePublishableKey,
|
||||
generateStoreHeaders,
|
||||
@@ -31,7 +31,8 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should create a customer address", async () => {
|
||||
const { customer, jwt } = await createAuthenticatedCustomer(
|
||||
appContainer
|
||||
api,
|
||||
storeHeaders
|
||||
)
|
||||
|
||||
const response = await api.post(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import { ICustomerModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import {
|
||||
generatePublishableKey,
|
||||
generateStoreHeaders,
|
||||
@@ -32,7 +32,8 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should delete a customer address", async () => {
|
||||
const { customer, jwt } = await createAuthenticatedCustomer(
|
||||
appContainer
|
||||
api,
|
||||
storeHeaders
|
||||
)
|
||||
|
||||
const address = await customerModuleService.createCustomerAddresses({
|
||||
@@ -65,7 +66,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("should fail to delete another customer's address", async () => {
|
||||
const { jwt } = await createAuthenticatedCustomer(appContainer)
|
||||
const { jwt } = await createAuthenticatedCustomer(api, storeHeaders)
|
||||
|
||||
const otherCustomer = await customerModuleService.createCustomers({
|
||||
first_name: "Jane",
|
||||
|
||||
@@ -28,7 +28,8 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should retrieve auth user's customer", async () => {
|
||||
const { customer, jwt } = await createAuthenticatedCustomer(
|
||||
appContainer
|
||||
api,
|
||||
storeHeaders
|
||||
)
|
||||
|
||||
const response = await api.get(`/store/customers/me`, {
|
||||
@@ -41,7 +42,7 @@ medusaIntegrationTestRunner({
|
||||
id: customer.id,
|
||||
first_name: "John",
|
||||
last_name: "Doe",
|
||||
email: "john@me.com",
|
||||
email: "tony@start.com",
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import { ICustomerModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import {
|
||||
generatePublishableKey,
|
||||
generateStoreHeaders,
|
||||
@@ -32,7 +32,8 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should get all customer addresses and its count", async () => {
|
||||
const { customer, jwt } = await createAuthenticatedCustomer(
|
||||
appContainer
|
||||
api,
|
||||
storeHeaders
|
||||
)
|
||||
|
||||
await customerModuleService.createCustomerAddresses([
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import { ICustomerModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import {
|
||||
generatePublishableKey,
|
||||
generateStoreHeaders,
|
||||
@@ -32,7 +32,8 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it.only("should update a customer address", async () => {
|
||||
const { customer, jwt } = await createAuthenticatedCustomer(
|
||||
appContainer
|
||||
api,
|
||||
storeHeaders
|
||||
)
|
||||
|
||||
const address = await customerModuleService.createCustomerAddresses({
|
||||
@@ -66,7 +67,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("should fail to update another customer's address", async () => {
|
||||
const { jwt } = await createAuthenticatedCustomer(appContainer)
|
||||
const { jwt } = await createAuthenticatedCustomer(api, storeHeaders)
|
||||
|
||||
const otherCustomer = await customerModuleService.createCustomers({
|
||||
first_name: "Jane",
|
||||
|
||||
Reference in New Issue
Block a user