merge develop and resolve conflicts
This commit is contained in:
@@ -17,6 +17,18 @@ Object {
|
||||
"material": null,
|
||||
"metadata": null,
|
||||
"mid_code": null,
|
||||
"options": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "test-variant-option",
|
||||
"metadata": null,
|
||||
"option_id": "test-option",
|
||||
"updated_at": Any<String>,
|
||||
"value": "Default variant",
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
],
|
||||
"origin_country": null,
|
||||
"prices": Array [
|
||||
Object {
|
||||
@@ -61,6 +73,18 @@ Object {
|
||||
"material": null,
|
||||
"metadata": null,
|
||||
"mid_code": null,
|
||||
"options": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "test-variant-option",
|
||||
"metadata": null,
|
||||
"option_id": "test-option",
|
||||
"updated_at": Any<String>,
|
||||
"value": "Default variant",
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
],
|
||||
"origin_country": null,
|
||||
"prices": Array [
|
||||
Object {
|
||||
|
||||
@@ -70,6 +70,24 @@ describe("/store/carts", () => {
|
||||
expect(getRes.status).toEqual(200)
|
||||
})
|
||||
|
||||
it("fails to create a cart when no region exist", async () => {
|
||||
const api = useApi()
|
||||
|
||||
await dbConnection.manager.query(
|
||||
`UPDATE "country" SET region_id=null WHERE iso_2 = 'us'`
|
||||
)
|
||||
await dbConnection.manager.query(`DELETE from region`)
|
||||
|
||||
try {
|
||||
await api.post("/store/carts")
|
||||
} catch (error) {
|
||||
expect(error.response.status).toEqual(400)
|
||||
expect(error.response.data.message).toEqual(
|
||||
"A region is required to create a cart"
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it("creates a cart with country", async () => {
|
||||
const api = useApi()
|
||||
|
||||
@@ -141,16 +159,16 @@ describe("/store/carts", () => {
|
||||
expect.assertions(2)
|
||||
const api = useApi()
|
||||
|
||||
try {
|
||||
await api.post("/store/carts/test-cart", {
|
||||
discounts: [{ code: "CREATED" }],
|
||||
let response = await api
|
||||
.post("/store/carts/test-cart", {
|
||||
discounts: [{ code: "SPENT" }],
|
||||
})
|
||||
.catch((error) => {
|
||||
expect(error.response.status).toEqual(400)
|
||||
expect(error.response.data.message).toEqual(
|
||||
"Discount has been used maximum allowed times"
|
||||
)
|
||||
})
|
||||
} catch (error) {
|
||||
expect(error.response.status).toEqual(400)
|
||||
expect(error.response.data.message).toEqual(
|
||||
"Discount has been used maximum allowed times"
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it("fails to apply expired discount", async () => {
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
const path = require("path");
|
||||
const path = require("path")
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb, useDb } = require("../../../helpers/use-db");
|
||||
const setupServer = require("../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../helpers/use-api")
|
||||
const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
|
||||
const draftOrderSeeder = require("../../helpers/draft-order-seeder");
|
||||
const draftOrderSeeder = require("../../helpers/draft-order-seeder")
|
||||
|
||||
jest.setTimeout(30000);
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("/store/carts (draft-orders)", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
let medusaProcess
|
||||
let dbConnection
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
const db = useDb();
|
||||
await db.shutdown();
|
||||
const db = useDb()
|
||||
await db.shutdown()
|
||||
|
||||
medusaProcess.kill();
|
||||
});
|
||||
medusaProcess.kill()
|
||||
})
|
||||
|
||||
describe("POST /admin/draft-order", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await draftOrderSeeder(dbConnection);
|
||||
await draftOrderSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
throw err;
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb();
|
||||
await db.teardown();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("completes a cart for a draft order thereby creating an order for the draft order", async () => {
|
||||
const api = useApi();
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post("/store/carts/test-cart/complete-cart", {})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
const createdOrder = await api
|
||||
.get(`/store/orders/${response.data.data.id}`, {})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
expect(createdOrder.data.order.cart_id).toEqual("test-cart");
|
||||
});
|
||||
});
|
||||
});
|
||||
expect(createdOrder.data.order.cart_id).toEqual("test-cart")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
const path = require("path");
|
||||
const { Region, GiftCard } = require("@medusajs/medusa");
|
||||
const path = require("path")
|
||||
const { Region, GiftCard } = require("@medusajs/medusa")
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb, useDb } = require("../../../helpers/use-db");
|
||||
const setupServer = require("../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../helpers/use-api")
|
||||
const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
|
||||
jest.setTimeout(30000);
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("/store/gift-cards", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
let medusaProcess
|
||||
let dbConnection
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
const db = useDb();
|
||||
await db.shutdown();
|
||||
medusaProcess.kill();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.shutdown()
|
||||
medusaProcess.kill()
|
||||
})
|
||||
|
||||
describe("GET /store/gift-cards/:code", () => {
|
||||
beforeEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
const manager = dbConnection.manager
|
||||
await manager.insert(Region, {
|
||||
id: "region",
|
||||
name: "Test Region",
|
||||
currency_code: "usd",
|
||||
tax_rate: 0,
|
||||
});
|
||||
})
|
||||
await manager.insert(GiftCard, {
|
||||
id: "gift_test",
|
||||
code: "GC_TEST",
|
||||
value: 200,
|
||||
balance: 120,
|
||||
region_id: "region",
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb();
|
||||
await db.teardown();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("retrieves a gift card", async () => {
|
||||
const api = useApi();
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.get("/store/gift-cards/GC_TEST");
|
||||
expect(response.status).toEqual(200);
|
||||
const response = await api.get("/store/gift-cards/GC_TEST")
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.gift_card).toEqual({
|
||||
id: "gift_test",
|
||||
code: "GC_TEST",
|
||||
value: 200,
|
||||
balance: 120,
|
||||
region: expect.any(Object),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -79,6 +79,9 @@ describe("/store/variants", () => {
|
||||
},
|
||||
],
|
||||
product: expect.any(Object),
|
||||
options: [
|
||||
{ created_at: expect.any(String), updated_at: expect.any(String) },
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
@@ -127,6 +130,9 @@ describe("/store/variants", () => {
|
||||
},
|
||||
],
|
||||
product: expect.any(Object),
|
||||
options: [
|
||||
{ created_at: expect.any(String), updated_at: expect.any(String) },
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,94 +1,96 @@
|
||||
const path = require("path");
|
||||
const path = require("path")
|
||||
|
||||
const { ReturnReason } = require("@medusajs/medusa");
|
||||
const { ReturnReason } = require("@medusajs/medusa")
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb, useDb } = require("../../../helpers/use-db");
|
||||
const setupServer = require("../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../helpers/use-api")
|
||||
const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
|
||||
jest.setTimeout(30000);
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("/store/return-reasons", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
let medusaProcess
|
||||
let dbConnection
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
const db = useDb();
|
||||
await db.shutdown();
|
||||
medusaProcess.kill();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.shutdown()
|
||||
medusaProcess.kill()
|
||||
})
|
||||
|
||||
describe("GET /store/return-reasons", () => {
|
||||
let rrId;
|
||||
let rrId_1;
|
||||
let rrId_2;
|
||||
let rrId
|
||||
let rrId_1
|
||||
let rrId_2
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
const created = dbConnection.manager.create(ReturnReason, {
|
||||
value: "wrong_size",
|
||||
label: "Wrong size",
|
||||
});
|
||||
})
|
||||
|
||||
const result = await dbConnection.manager.save(created);
|
||||
rrId = result.id;
|
||||
const result = await dbConnection.manager.save(created)
|
||||
rrId = result.id
|
||||
|
||||
const created_child = dbConnection.manager.create(ReturnReason, {
|
||||
value: "too_big",
|
||||
label: "Too Big",
|
||||
parent_return_reason_id: rrId
|
||||
});
|
||||
parent_return_reason_id: rrId,
|
||||
})
|
||||
|
||||
const result_child = await dbConnection.manager.save(created_child);
|
||||
rrId_1 = result_child.id;
|
||||
const result_child = await dbConnection.manager.save(created_child)
|
||||
rrId_1 = result_child.id
|
||||
|
||||
const created_2 = dbConnection.manager.create(ReturnReason, {
|
||||
value: "too_big_1",
|
||||
label: "Too Big 1",
|
||||
});
|
||||
})
|
||||
|
||||
const result_2 = await dbConnection.manager.save(created_2);
|
||||
rrId_2 = result_2.id;
|
||||
const result_2 = await dbConnection.manager.save(created_2)
|
||||
rrId_2 = result_2.id
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
throw err;
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb();
|
||||
await db.teardown();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("list return reasons", async () => {
|
||||
const api = useApi();
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.get("/store/return-reasons").catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.return_reasons).toEqual([
|
||||
expect.objectContaining({
|
||||
id: rrId,
|
||||
value: "wrong_size",
|
||||
return_reason_children:[expect.objectContaining({
|
||||
id: rrId_1,
|
||||
value: "too_big",
|
||||
}),]
|
||||
return_reason_children: [
|
||||
expect.objectContaining({
|
||||
id: rrId_1,
|
||||
value: "too_big",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: rrId_2,
|
||||
value: "too_big_1",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const path = require("path");
|
||||
const path = require("path")
|
||||
const {
|
||||
Region,
|
||||
ReturnReason,
|
||||
@@ -12,56 +12,56 @@ const {
|
||||
LineItem,
|
||||
Discount,
|
||||
DiscountRule,
|
||||
} = require("@medusajs/medusa");
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb, useDb } = require("../../../helpers/use-db");
|
||||
const setupServer = require("../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../helpers/use-api")
|
||||
const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
|
||||
jest.setTimeout(30000);
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("/store/carts", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
let medusaProcess
|
||||
let dbConnection
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
const db = useDb();
|
||||
await db.shutdown();
|
||||
medusaProcess.kill();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.shutdown()
|
||||
medusaProcess.kill()
|
||||
})
|
||||
|
||||
describe("POST /store/returns", () => {
|
||||
let rrId;
|
||||
let rrId_child;
|
||||
let rrResult;
|
||||
let rrId
|
||||
let rrId_child
|
||||
let rrResult
|
||||
|
||||
beforeEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
const manager = dbConnection.manager
|
||||
await manager.query(
|
||||
`ALTER SEQUENCE order_display_id_seq RESTART WITH 111`
|
||||
);
|
||||
)
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
await manager.insert(Region, {
|
||||
id: "region",
|
||||
name: "Test Region",
|
||||
currency_code: "usd",
|
||||
tax_rate: 0,
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
await manager.insert(Customer, {
|
||||
id: "cus_1234",
|
||||
email: "test@email.com",
|
||||
});
|
||||
})
|
||||
|
||||
await manager.insert(Order, {
|
||||
id: "order_test",
|
||||
@@ -71,7 +71,7 @@ describe("/store/carts", () => {
|
||||
region_id: "region",
|
||||
tax_rate: 0,
|
||||
currency_code: "usd",
|
||||
});
|
||||
})
|
||||
|
||||
await manager.insert(DiscountRule, {
|
||||
id: "discount_rule_id",
|
||||
@@ -79,7 +79,7 @@ describe("/store/carts", () => {
|
||||
value: 10,
|
||||
allocation: "total",
|
||||
type: "percentage",
|
||||
});
|
||||
})
|
||||
|
||||
const d = manager.create(Discount, {
|
||||
id: "test-discount",
|
||||
@@ -87,9 +87,9 @@ describe("/store/carts", () => {
|
||||
is_dynamic: false,
|
||||
is_disabled: false,
|
||||
rule_id: "discount_rule_id",
|
||||
});
|
||||
})
|
||||
|
||||
await manager.save(d);
|
||||
await manager.save(d)
|
||||
|
||||
const ord = manager.create(Order, {
|
||||
id: "order_with_discount",
|
||||
@@ -99,18 +99,18 @@ describe("/store/carts", () => {
|
||||
region_id: "region",
|
||||
tax_rate: 0,
|
||||
currency_code: "usd",
|
||||
});
|
||||
})
|
||||
|
||||
ord.discounts = [d];
|
||||
ord.discounts = [d]
|
||||
|
||||
await manager.save(ord);
|
||||
await manager.save(ord)
|
||||
|
||||
await manager.insert(Product, {
|
||||
id: "test-product",
|
||||
title: "test product",
|
||||
profile_id: defaultProfile.id,
|
||||
options: [{ id: "test-option", title: "Size" }],
|
||||
});
|
||||
})
|
||||
|
||||
await manager.insert(ProductVariant, {
|
||||
id: "test-variant",
|
||||
@@ -123,7 +123,7 @@ describe("/store/carts", () => {
|
||||
value: "Size",
|
||||
},
|
||||
],
|
||||
});
|
||||
})
|
||||
|
||||
await manager.insert(LineItem, {
|
||||
id: "test-item",
|
||||
@@ -135,7 +135,7 @@ describe("/store/carts", () => {
|
||||
unit_price: 8000,
|
||||
quantity: 1,
|
||||
variant_id: "test-variant",
|
||||
});
|
||||
})
|
||||
|
||||
await manager.insert(ShippingOption, {
|
||||
id: "test-option",
|
||||
@@ -147,35 +147,35 @@ describe("/store/carts", () => {
|
||||
price_type: "flat_rate",
|
||||
amount: 1000,
|
||||
is_return: true,
|
||||
});
|
||||
})
|
||||
|
||||
const created = dbConnection.manager.create(ReturnReason, {
|
||||
value: "wrong_size",
|
||||
label: "Wrong Size",
|
||||
});
|
||||
const result = await dbConnection.manager.save(created);
|
||||
})
|
||||
const result = await dbConnection.manager.save(created)
|
||||
|
||||
rrResult = result
|
||||
rrId = result.id;
|
||||
rrId = result.id
|
||||
|
||||
const created_1 = dbConnection.manager.create(ReturnReason, {
|
||||
value: "too_big",
|
||||
label: "Too Big",
|
||||
parent_return_reason_id: rrId,
|
||||
});
|
||||
})
|
||||
|
||||
const result_1 = await dbConnection.manager.save(created_1);
|
||||
const result_1 = await dbConnection.manager.save(created_1)
|
||||
|
||||
rrId_child = result_1.id;
|
||||
});
|
||||
rrId_child = result_1.id
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb();
|
||||
await db.teardown();
|
||||
});
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("creates a return", async () => {
|
||||
const api = useApi();
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
@@ -188,16 +188,16 @@ describe("/store/carts", () => {
|
||||
],
|
||||
})
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
return err.response
|
||||
})
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.return.refund_amount).toEqual(8000);
|
||||
});
|
||||
expect(response.data.return.refund_amount).toEqual(8000)
|
||||
})
|
||||
|
||||
it("failes to create a return with a reason category", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
order_id: "order_test",
|
||||
@@ -211,17 +211,18 @@ describe("/store/carts", () => {
|
||||
],
|
||||
})
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
return err.response
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(400);
|
||||
expect(response.data.message).toEqual('Cannot apply return reason category')
|
||||
|
||||
});
|
||||
expect(response.status).toEqual(400)
|
||||
expect(response.data.message).toEqual(
|
||||
"Cannot apply return reason category"
|
||||
)
|
||||
})
|
||||
|
||||
it("creates a return with reasons", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
order_id: "order_test",
|
||||
@@ -236,28 +237,28 @@ describe("/store/carts", () => {
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err.response)
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
return err.response
|
||||
})
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.return.items).toEqual([
|
||||
expect.objectContaining({
|
||||
reason_id: rrId_child,
|
||||
note: "TOO small",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
])
|
||||
})
|
||||
|
||||
it("creates a return with discount and non-discountable item", async () => {
|
||||
const api = useApi();
|
||||
const api = useApi()
|
||||
|
||||
await dbConnection.manager.query(
|
||||
`UPDATE line_item set allow_discounts=false where id='test-item'`
|
||||
);
|
||||
)
|
||||
|
||||
await dbConnection.manager.query(
|
||||
`UPDATE line_item set order_id='order_with_discount' where id='test-item'`
|
||||
);
|
||||
)
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
@@ -270,15 +271,15 @@ describe("/store/carts", () => {
|
||||
],
|
||||
})
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
return err.response
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.return.refund_amount).toEqual(8000);
|
||||
});
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.return.refund_amount).toEqual(8000)
|
||||
})
|
||||
|
||||
it("creates a return with shipping method", async () => {
|
||||
const api = useApi();
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
@@ -294,12 +295,11 @@ describe("/store/carts", () => {
|
||||
],
|
||||
})
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
return err.response
|
||||
})
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.return.refund_amount).toEqual(7000);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
expect(response.data.return.refund_amount).toEqual(7000)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user