fix: make it possible to update order shipping address (#668)
This commit is contained in:
@@ -74,6 +74,63 @@ describe("/admin/orders", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /admin/orders/:id", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await orderSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("updates a shipping adress", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/admin/orders/test-order",
|
||||
{
|
||||
email: "test@test.com",
|
||||
shipping_address: {
|
||||
address_1: "Some Street",
|
||||
address_2: "",
|
||||
province: "",
|
||||
postal_code: "1235",
|
||||
city: "losangeles",
|
||||
country_code: "us",
|
||||
},
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
.catch((err) => {
|
||||
console.log(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.order.shipping_address).toMatchSnapshot({
|
||||
id: expect.any(String),
|
||||
address_1: "Some Street",
|
||||
address_2: "",
|
||||
province: "",
|
||||
postal_code: "1235",
|
||||
city: "losangeles",
|
||||
country_code: "us",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("GET /admin/orders", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user