fix: merge develop

This commit is contained in:
Sebastian Rindom
2021-10-15 18:44:19 +02:00
31 changed files with 2145 additions and 1769 deletions

View File

@@ -80,7 +80,6 @@ describe("/admin/orders", () => {
await adminSeeder(dbConnection)
await orderSeeder(dbConnection)
await swapSeeder(dbConnection)
await claimSeeder(dbConnection)
} catch (err) {
console.log(err)
throw err
@@ -223,6 +222,48 @@ describe("/admin/orders", () => {
})
})
describe("POST /admin/orders/:id/swaps", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await orderSeeder(dbConnection)
await claimSeeder(dbConnection)
} catch (err) {
console.log(err)
throw err
}
})
afterEach(async () => {
const db = useDb()
await db.teardown()
})
it("creates a swap on a claim", async () => {
const api = useApi()
const swapOnSwap = await api.post(
"/admin/orders/order-with-claim/swaps",
{
return_items: [
{
item_id: "test-item-co-2",
quantity: 1,
},
],
additional_items: [{ variant_id: "test-variant", quantity: 1 }],
},
{
headers: {
authorization: "Bearer test_token",
},
}
)
expect(swapOnSwap.status).toEqual(200)
})
})
describe("POST /admin/orders/:id/claims", () => {
beforeEach(async () => {
try {
@@ -318,6 +359,43 @@ describe("/admin/orders", () => {
)
})
it("creates a claim on a claim", async () => {
const api = useApi()
const claimOnClaim = await api
.post(
"/admin/orders/order-with-claim/claims",
{
type: "replace",
claim_items: [
{
item_id: "test-item-co-2",
quantity: 1,
reason: "production_failure",
tags: ["fluff"],
images: ["https://test.image.com"],
},
],
additional_items: [
{
variant_id: "test-variant",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
)
.catch((err) => {
console.log(err)
})
expect(claimOnClaim.status).toEqual(200)
})
it("creates a claim with a shipping address", async () => {
const api = useApi()
@@ -841,6 +919,61 @@ describe("/admin/orders", () => {
})
})
describe("POST /admin/orders/:id/claims", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await orderSeeder(dbConnection)
await swapSeeder(dbConnection)
} catch (err) {
console.log(err)
throw err
}
})
afterEach(async () => {
const db = useDb()
await db.teardown()
})
it("creates a claim on a swap", async () => {
const api = useApi()
const claimOnClaim = await api
.post(
"/admin/orders/order-with-swap/claims",
{
type: "replace",
claim_items: [
{
item_id: "return-item-1",
quantity: 1,
reason: "production_failure",
tags: ["fluff"],
images: ["https://test.image.com"],
},
],
additional_items: [
{
variant_id: "test-variant",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
)
.catch((err) => {
console.log(err)
})
expect(claimOnClaim.status).toEqual(200)
})
})
describe("POST /admin/orders/:id/return", () => {
let rrId
beforeEach(async () => {

View File

@@ -16,20 +16,3 @@ Object {
"updated_at": Any<String>,
}
`;
exports[`/admin/discounts creates store session correctly 1`] = `
Object {
"billing_address_id": null,
"created_at": Any<String>,
"deleted_at": null,
"email": "test@testesen.dk",
"first_name": "test",
"has_account": true,
"id": Any<String>,
"last_name": "testesen",
"metadata": null,
"orders": Array [],
"phone": "12345678",
"updated_at": Any<String>,
}
`;

View File

@@ -159,7 +159,7 @@ describe("/store/carts", () => {
expect.assertions(2)
const api = useApi()
let response = await api
await api
.post("/store/carts/test-cart", {
discounts: [{ code: "SPENT" }],
})

View File

@@ -150,6 +150,17 @@ module.exports = async (connection, data = {}) => {
await manager.save(d)
const usedDiscount = manager.create(Discount, {
id: "used-discount",
code: "USED",
is_dynamic: false,
is_disabled: false,
usage_limit: 1,
usage_count: 1,
})
await manager.save(usedDiscount)
const expiredRule = manager.create(DiscountRule, {
id: "expiredRule",
description: "expired rule",

View File

@@ -8,15 +8,15 @@
"build": "babel src -d dist --extensions \".ts,.js\""
},
"dependencies": {
"@medusajs/medusa": "1.1.41-dev-1634220658423",
"medusa-interfaces": "1.1.23-dev-1634220658423",
"@medusajs/medusa": "1.1.41-dev-1634316075104",
"medusa-interfaces": "1.1.23-dev-1634316075104",
"typeorm": "^0.2.31"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/node": "^7.12.10",
"babel-preset-medusa-package": "1.1.15-dev-1634220658423",
"babel-preset-medusa-package": "1.1.15-dev-1634316075104",
"jest": "^26.6.3"
}
}

File diff suppressed because it is too large Load Diff