chore(integration): throw errors on catch blocks (#2091)
Why: Suppressing errors and not failing the execution will lead to misleading errors of the following tests. Fixes CORE-461
This commit is contained in:
1 parent
5a964e6439
commit
ffd6234356
50 files changed
+60
-641
No files matched your search
@@ -143,7 +143,7 @@ jobs:
|
|||||||
working-directory: integration-tests/api
|
working-directory: integration-tests/api
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: yarn test --runInBand
|
run: yarn test
|
||||||
working-directory: integration-tests/api
|
working-directory: integration-tests/api
|
||||||
env:
|
env:
|
||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
|
|||||||
@@ -18,11 +18,7 @@ describe("/admin/auth", () => {
|
|||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
|
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (e) {
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -25,13 +25,8 @@ describe("/admin/collections", () => {
|
|||||||
|
|
||||||
describe("/admin/collections/:id", () => {
|
describe("/admin/collections/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -128,13 +123,8 @@ describe("/admin/collections", () => {
|
|||||||
|
|
||||||
describe("/admin/collections", () => {
|
describe("/admin/collections", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -27,13 +27,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("POST /admin/customer-groups", () => {
|
describe("POST /admin/customer-groups", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -88,13 +83,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("DELETE /admin/customer-groups", () => {
|
describe("DELETE /admin/customer-groups", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -195,13 +185,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("GET /admin/customer-groups/{id}/customers", () => {
|
describe("GET /admin/customer-groups/{id}/customers", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -242,13 +227,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("POST /admin/customer-groups/{id}/customers/batch", () => {
|
describe("POST /admin/customer-groups/{id}/customers/batch", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -418,13 +398,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("POST /admin/customer-groups/:id", () => {
|
describe("POST /admin/customer-groups/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -500,13 +475,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("GET /admin/customer-groups", () => {
|
describe("GET /admin/customer-groups", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -559,13 +529,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("GET /admin/customer-groups/:id", () => {
|
describe("GET /admin/customer-groups/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -641,13 +606,8 @@ describe("/admin/customer-groups", () => {
|
|||||||
|
|
||||||
describe("DELETE /admin/customer-groups/{id}/batch", () => {
|
describe("DELETE /admin/customer-groups/{id}/batch", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ describe("/admin/customers", () => {
|
|||||||
|
|
||||||
describe("GET /admin/customers", () => {
|
describe("GET /admin/customers", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -164,12 +159,7 @@ describe("/admin/customers", () => {
|
|||||||
|
|
||||||
describe("POST /admin/customers", () => {
|
describe("POST /admin/customers", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -213,13 +203,8 @@ describe("/admin/customers", () => {
|
|||||||
|
|
||||||
describe("POST /admin/customers/:id", () => {
|
describe("POST /admin/customers/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -368,13 +353,8 @@ describe("/admin/customers", () => {
|
|||||||
|
|
||||||
describe("GET /admin/customers/:id", () => {
|
describe("GET /admin/customers/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -427,13 +427,8 @@ describe("/admin/discounts", () => {
|
|||||||
|
|
||||||
describe("POST /admin/discounts", () => {
|
describe("POST /admin/discounts", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await discountSeeder(dbConnection)
|
await discountSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -2150,11 +2145,7 @@ describe("/admin/discounts", () => {
|
|||||||
|
|
||||||
describe("GET /admin/discounts/:id/conditions/:condition_id", () => {
|
describe("GET /admin/discounts/:id/conditions/:condition_id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
const prod = await simpleProductFactory(dbConnection, {
|
const prod = await simpleProductFactory(dbConnection, {
|
||||||
type: "pants",
|
type: "pants",
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ describe("/admin/draft-orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/draft-orders", () => {
|
describe("POST /admin/draft-orders", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await draftOrderSeeder(dbConnection)
|
await draftOrderSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -359,7 +354,7 @@ describe("/admin/draft-orders", () => {
|
|||||||
const payload = {
|
const payload = {
|
||||||
email: "oli@test.dk",
|
email: "oli@test.dk",
|
||||||
shipping_address: "oli-shipping",
|
shipping_address: "oli-shipping",
|
||||||
discounts: [{ code: "TEST" }, { code: "free-shipping"}],
|
discounts: [{ code: "TEST" }, { code: "free-shipping" }],
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
variant_id: "test-variant",
|
variant_id: "test-variant",
|
||||||
@@ -426,7 +421,7 @@ describe("/admin/draft-orders", () => {
|
|||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
code: "free-shipping",
|
code: "free-shipping",
|
||||||
})
|
}),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -524,12 +519,8 @@ describe("/admin/draft-orders", () => {
|
|||||||
})
|
})
|
||||||
describe("GET /admin/draft-orders", () => {
|
describe("GET /admin/draft-orders", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await draftOrderSeeder(dbConnection)
|
await draftOrderSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -605,13 +596,8 @@ describe("/admin/draft-orders", () => {
|
|||||||
|
|
||||||
describe("DELETE /admin/draft-orders/:id", () => {
|
describe("DELETE /admin/draft-orders/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await draftOrderSeeder(dbConnection)
|
await draftOrderSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -644,12 +630,8 @@ describe("/admin/draft-orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/draft-orders/:id/line-items/:line_id", () => {
|
describe("POST /admin/draft-orders/:id/line-items/:line_id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await draftOrderSeeder(dbConnection, { status: "open" })
|
await draftOrderSeeder(dbConnection, { status: "open" })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -733,12 +715,8 @@ describe("/admin/draft-orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/draft-orders/:id", () => {
|
describe("POST /admin/draft-orders/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await draftOrderSeeder(dbConnection, { status: "open" })
|
await draftOrderSeeder(dbConnection, { status: "open" })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ describe("/admin/gift-cards", () => {
|
|||||||
describe("GET /admin/gift-cards", () => {
|
describe("GET /admin/gift-cards", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await manager.insert(Region, {
|
await manager.insert(Region, {
|
||||||
id: "test-region",
|
id: "test-region",
|
||||||
@@ -50,10 +50,6 @@ describe("/admin/gift-cards", () => {
|
|||||||
balance: 200000,
|
balance: 200000,
|
||||||
region_id: "test-region",
|
region_id: "test-region",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -136,7 +132,7 @@ describe("/admin/gift-cards", () => {
|
|||||||
describe("POST /admin/gift-cards", () => {
|
describe("POST /admin/gift-cards", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await manager.insert(Region, {
|
await manager.insert(Region, {
|
||||||
id: "region",
|
id: "region",
|
||||||
@@ -151,10 +147,6 @@ describe("/admin/gift-cards", () => {
|
|||||||
balance: 20000,
|
balance: 20000,
|
||||||
region_id: "region",
|
region_id: "region",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -36,13 +36,10 @@ describe("/admin/notes", () => {
|
|||||||
describe("GET /admin/notes/:id", () => {
|
describe("GET /admin/notes/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await manager.insert(Note, note)
|
await manager.insert(Note, note)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -73,11 +70,7 @@ describe("/admin/notes", () => {
|
|||||||
|
|
||||||
describe("POST /admin/notes", () => {
|
describe("POST /admin/notes", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -121,7 +114,7 @@ describe("/admin/notes", () => {
|
|||||||
describe("GET /admin/notes", () => {
|
describe("GET /admin/notes", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await manager.insert(Note, { ...note, id: "note1" })
|
await manager.insert(Note, { ...note, id: "note1" })
|
||||||
@@ -131,9 +124,6 @@ describe("/admin/notes", () => {
|
|||||||
id: "note3",
|
id: "note3",
|
||||||
resource_id: "resource2",
|
resource_id: "resource2",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -178,13 +168,10 @@ describe("/admin/notes", () => {
|
|||||||
describe("POST /admin/notes/:id", () => {
|
describe("POST /admin/notes/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await manager.insert(Note, note)
|
await manager.insert(Note, note)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -226,13 +213,10 @@ describe("/admin/notes", () => {
|
|||||||
describe("DELETE /admin/notes/:id", () => {
|
describe("DELETE /admin/notes/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await manager.insert(Note, note)
|
await manager.insert(Note, note)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -44,13 +44,8 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("GET /admin/orders", () => {
|
describe("GET /admin/orders", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -129,14 +124,9 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("GET /admin/orders", () => {
|
describe("GET /admin/orders", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
|
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
|
|
||||||
@@ -276,14 +266,9 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/orders/:id/swaps", () => {
|
describe("POST /admin/orders/:id/swaps", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await claimSeeder(dbConnection)
|
await claimSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -318,14 +303,9 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/orders/:id/claims", () => {
|
describe("POST /admin/orders/:id/claims", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await claimSeeder(dbConnection)
|
await claimSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1216,14 +1196,9 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/orders/:id/claims", () => {
|
describe("POST /admin/orders/:id/claims", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1272,7 +1247,6 @@ describe("/admin/orders", () => {
|
|||||||
describe("POST /admin/orders/:id/return", () => {
|
describe("POST /admin/orders/:id/return", () => {
|
||||||
let rrId
|
let rrId
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
|
|
||||||
@@ -1283,10 +1257,6 @@ describe("/admin/orders", () => {
|
|||||||
const result = await dbConnection.manager.save(created)
|
const result = await dbConnection.manager.save(created)
|
||||||
|
|
||||||
rrId = result.id
|
rrId = result.id
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1392,17 +1362,12 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("GET /admin/orders", () => {
|
describe("GET /admin/orders", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
// Manually insert date for filtering
|
// Manually insert date for filtering
|
||||||
const createdAt = new Date("26 January 1997 12:00 UTC")
|
const createdAt = new Date("26 January 1997 12:00 UTC")
|
||||||
await orderSeeder(dbConnection, {
|
await orderSeeder(dbConnection, {
|
||||||
created_at: createdAt.toISOString(),
|
created_at: createdAt.toISOString(),
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1521,7 +1486,8 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
expect(response.status).toEqual(200)
|
expect(response.status).toEqual(200)
|
||||||
expect(response.data.count).toEqual(2)
|
expect(response.data.count).toEqual(2)
|
||||||
expect(response.data.orders).toEqual(expect.arrayContaining([
|
expect(response.data.orders).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: "test-order",
|
id: "test-order",
|
||||||
shipping_address: expect.objectContaining({ first_name: "lebron" }),
|
shipping_address: expect.objectContaining({ first_name: "lebron" }),
|
||||||
@@ -1530,7 +1496,8 @@ describe("/admin/orders", () => {
|
|||||||
id: "discount-order",
|
id: "discount-order",
|
||||||
shipping_address: expect.objectContaining({ first_name: "lebron" }),
|
shipping_address: expect.objectContaining({ first_name: "lebron" }),
|
||||||
}),
|
}),
|
||||||
]))
|
])
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("successfully lists orders with greater than", async () => {
|
it("successfully lists orders with greater than", async () => {
|
||||||
@@ -1727,14 +1694,9 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
describe("POST /admin/orders/:id/swaps", () => {
|
describe("POST /admin/orders/:id/swaps", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -2137,7 +2099,6 @@ describe("/admin/orders", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("Only allows canceling swap after canceling fulfillments", async () => {
|
it("Only allows canceling swap after canceling fulfillments", async () => {
|
||||||
try {
|
|
||||||
const swap_id = "swap-w-f"
|
const swap_id = "swap-w-f"
|
||||||
|
|
||||||
const swap = await callGet({
|
const swap = await callGet({
|
||||||
@@ -2161,9 +2122,6 @@ describe("/admin/orders", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
await expectCancelToReturn({ code: 200 })
|
await expectCancelToReturn({ code: 200 })
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Only allows canceling swap after canceling return", async () => {
|
it("Only allows canceling swap after canceling return", async () => {
|
||||||
|
|||||||
@@ -37,14 +37,9 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("POST /admin/price-list", () => {
|
describe("POST /admin/price-list", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -116,14 +111,9 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("GET /admin/price-lists", () => {
|
describe("GET /admin/price-lists", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -372,15 +362,10 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("POST /admin/price-lists/:id", () => {
|
describe("POST /admin/price-lists/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await customerSeeder(dbConnection)
|
await customerSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -659,14 +644,9 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("POST /admin/price-lists/:id/prices/batch", () => {
|
describe("POST /admin/price-lists/:id/prices/batch", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -949,14 +929,9 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("DELETE /admin/price-lists/:id", () => {
|
describe("DELETE /admin/price-lists/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1001,14 +976,9 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("tests cascade on delete", () => {
|
describe("tests cascade on delete", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1045,14 +1015,9 @@ describe("/admin/price-lists", () => {
|
|||||||
|
|
||||||
describe("DELETE /admin/price-lists/:id/prices/batch", () => {
|
describe("DELETE /admin/price-lists/:id/prices/batch", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1102,7 +1067,6 @@ describe("/admin/price-lists", () => {
|
|||||||
describe("GET /admin/price-lists/:id/products", () => {
|
describe("GET /admin/price-lists/:id/products", () => {
|
||||||
let tag
|
let tag
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await simpleProductFactory(
|
await simpleProductFactory(
|
||||||
@@ -1151,10 +1115,6 @@ describe("/admin/price-lists", () => {
|
|||||||
{ variant_id: "test-variant-4", currency_code: "usd", amount: 200 },
|
{ variant_id: "test-variant-4", currency_code: "usd", amount: 200 },
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1278,7 +1238,6 @@ describe("/admin/price-lists", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
product1 = await simpleProductFactory(
|
product1 = await simpleProductFactory(
|
||||||
@@ -1329,10 +1288,6 @@ describe("/admin/price-lists", () => {
|
|||||||
})),
|
})),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ describe("/admin/product-tags", () => {
|
|||||||
|
|
||||||
describe("GET /admin/product-tags", () => {
|
describe("GET /admin/product-tags", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ describe("/admin/product-types", () => {
|
|||||||
|
|
||||||
describe("GET /admin/product-types", () => {
|
describe("GET /admin/product-types", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -62,10 +57,7 @@ describe("/admin/product-types", () => {
|
|||||||
updated_at: expect.any(String),
|
updated_at: expect.any(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(res.data.product_types).toMatchSnapshot([
|
expect(res.data.product_types).toMatchSnapshot([typeMatch, typeMatch])
|
||||||
typeMatch,
|
|
||||||
typeMatch,
|
|
||||||
])
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns a list of product types matching free text search param", async () => {
|
it("returns a list of product types matching free text search param", async () => {
|
||||||
@@ -90,13 +82,11 @@ describe("/admin/product-types", () => {
|
|||||||
|
|
||||||
// The value of the type should match the search param
|
// The value of the type should match the search param
|
||||||
expect(res.data.product_types.map((pt) => pt.value)).toEqual([
|
expect(res.data.product_types.map((pt) => pt.value)).toEqual([
|
||||||
"test-type-new"
|
"test-type-new",
|
||||||
])
|
])
|
||||||
|
|
||||||
// Should only return one type as there is only one match to the search param
|
// Should only return one type as there is only one match to the search param
|
||||||
expect(res.data.product_types).toMatchSnapshot([
|
expect(res.data.product_types).toMatchSnapshot([typeMatch])
|
||||||
typeMatch
|
|
||||||
])
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -34,13 +34,8 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("GET /admin/products", () => {
|
describe("GET /admin/products", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -852,13 +847,8 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("POST /admin/products", () => {
|
describe("POST /admin/products", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1427,13 +1417,8 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("GET /admin/products/:id/variants", () => {
|
describe("GET /admin/products/:id/variants", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1481,14 +1466,9 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("updates a variant's default prices (ignores prices associated with a Price List)", () => {
|
describe("updates a variant's default prices (ignores prices associated with a Price List)", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await priceListSeeder(dbConnection)
|
await priceListSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1757,13 +1737,8 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("testing for soft-deletion + uniqueness on handles, collection and variant properties", () => {
|
describe("testing for soft-deletion + uniqueness on handles, collection and variant properties", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -2256,13 +2231,8 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("GET /admin/products/tag-usage", () => {
|
describe("GET /admin/products/tag-usage", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ describe("/admin/regions", () => {
|
|||||||
|
|
||||||
describe("Remove region from country on delete", () => {
|
describe("Remove region from country on delete", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
await manager.insert(Region, {
|
await manager.insert(Region, {
|
||||||
@@ -40,10 +39,6 @@ describe("/admin/regions", () => {
|
|||||||
await manager.query(
|
await manager.query(
|
||||||
`UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'`
|
`UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'`
|
||||||
)
|
)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -203,7 +198,6 @@ describe("/admin/regions", () => {
|
|||||||
|
|
||||||
describe("DELETE /admin/regions/:id", () => {
|
describe("DELETE /admin/regions/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
await manager.insert(Region, {
|
await manager.insert(Region, {
|
||||||
@@ -216,10 +210,6 @@ describe("/admin/regions", () => {
|
|||||||
await manager.query(
|
await manager.query(
|
||||||
`UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'`
|
`UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'`
|
||||||
)
|
)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -27,12 +27,7 @@ describe("/admin/return-reasons", () => {
|
|||||||
|
|
||||||
describe("POST /admin/return-reasons", () => {
|
describe("POST /admin/return-reasons", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ describe("/admin/returns", () => {
|
|||||||
let rrId
|
let rrId
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
|
|
||||||
@@ -41,10 +40,6 @@ describe("/admin/returns", () => {
|
|||||||
})
|
})
|
||||||
const resultRR = await dbConnection.manager.save(created)
|
const resultRR = await dbConnection.manager.save(created)
|
||||||
rrId = resultRR.id
|
rrId = resultRR.id
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -233,7 +228,7 @@ describe("/admin/returns", () => {
|
|||||||
return_shipping: {
|
return_shipping: {
|
||||||
option_id: "test-option",
|
option_id: "test-option",
|
||||||
price: 0,
|
price: 0,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -52,15 +52,11 @@ describe("sales channels", () => {
|
|||||||
let salesChannel
|
let salesChannel
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
description: "test description",
|
description: "test description",
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -92,7 +88,6 @@ describe("sales channels", () => {
|
|||||||
let salesChannel2
|
let salesChannel2
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
salesChannel1 = await simpleSalesChannelFactory(dbConnection, {
|
salesChannel1 = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
@@ -102,9 +97,6 @@ describe("sales channels", () => {
|
|||||||
name: "test name 2",
|
name: "test name 2",
|
||||||
description: "test description 2",
|
description: "test description 2",
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -207,15 +199,11 @@ describe("sales channels", () => {
|
|||||||
let sc
|
let sc
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
sc = await simpleSalesChannelFactory(dbConnection, {
|
sc = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
description: "test description",
|
description: "test description",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -256,11 +244,7 @@ describe("sales channels", () => {
|
|||||||
|
|
||||||
describe("POST /admin/sales-channels", () => {
|
describe("POST /admin/sales-channels", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -324,7 +308,6 @@ describe("sales channels", () => {
|
|||||||
let salesChannel
|
let salesChannel
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
@@ -336,9 +319,6 @@ describe("sales channels", () => {
|
|||||||
id: "test-channel",
|
id: "test-channel",
|
||||||
is_default: true,
|
is_default: true,
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -454,7 +434,6 @@ describe("sales channels", () => {
|
|||||||
describe("GET /admin/orders/:id", () => {
|
describe("GET /admin/orders/:id", () => {
|
||||||
let order
|
let order
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
order = await simpleOrderFactory(dbConnection, {
|
order = await simpleOrderFactory(dbConnection, {
|
||||||
@@ -463,9 +442,6 @@ describe("sales channels", () => {
|
|||||||
description: "test description",
|
description: "test description",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -495,7 +471,6 @@ describe("sales channels", () => {
|
|||||||
|
|
||||||
describe("GET /admin/orders?expand=sales_channels", () => {
|
describe("GET /admin/orders?expand=sales_channels", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await simpleOrderFactory(dbConnection, {
|
await simpleOrderFactory(dbConnection, {
|
||||||
@@ -504,9 +479,6 @@ describe("sales channels", () => {
|
|||||||
description: "test description",
|
description: "test description",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -537,7 +509,6 @@ describe("sales channels", () => {
|
|||||||
describe("GET /admin/product/:id", () => {
|
describe("GET /admin/product/:id", () => {
|
||||||
let product
|
let product
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
product = await simpleProductFactory(dbConnection, {
|
product = await simpleProductFactory(dbConnection, {
|
||||||
@@ -552,9 +523,6 @@ describe("sales channels", () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -589,7 +557,6 @@ describe("sales channels", () => {
|
|||||||
|
|
||||||
describe("GET /admin/products?expand[]=sales_channels", () => {
|
describe("GET /admin/products?expand[]=sales_channels", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await simpleProductFactory(dbConnection, {
|
await simpleProductFactory(dbConnection, {
|
||||||
@@ -604,9 +571,6 @@ describe("sales channels", () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -645,7 +609,6 @@ describe("sales channels", () => {
|
|||||||
let product
|
let product
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
product = await simpleProductFactory(dbConnection, {
|
product = await simpleProductFactory(dbConnection, {
|
||||||
id: "product_1",
|
id: "product_1",
|
||||||
@@ -656,9 +619,6 @@ describe("sales channels", () => {
|
|||||||
description: "test description",
|
description: "test description",
|
||||||
products: [product],
|
products: [product],
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -730,7 +690,6 @@ describe("sales channels", () => {
|
|||||||
let product
|
let product
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
@@ -740,9 +699,6 @@ describe("sales channels", () => {
|
|||||||
id: "product_1",
|
id: "product_1",
|
||||||
title: "test title",
|
title: "test title",
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -798,7 +754,6 @@ describe("sales channels", () => {
|
|||||||
let order
|
let order
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
order = await simpleOrderFactory(dbConnection, {
|
order = await simpleOrderFactory(dbConnection, {
|
||||||
sales_channel: {
|
sales_channel: {
|
||||||
@@ -807,10 +762,6 @@ describe("sales channels", () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -850,7 +801,6 @@ describe("sales channels", () => {
|
|||||||
let salesChannel
|
let salesChannel
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
const product = await simpleProductFactory(dbConnection, productData)
|
const product = await simpleProductFactory(dbConnection, productData)
|
||||||
@@ -859,10 +809,6 @@ describe("sales channels", () => {
|
|||||||
description: "test description",
|
description: "test description",
|
||||||
products: [product],
|
products: [product],
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -900,17 +846,12 @@ describe("sales channels", () => {
|
|||||||
let salesChannel
|
let salesChannel
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
description: "test description",
|
description: "test description",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -965,17 +906,12 @@ describe("sales channels", () => {
|
|||||||
let salesChannel
|
let salesChannel
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "test name",
|
name: "test name",
|
||||||
description: "test description",
|
description: "test description",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -32,13 +32,8 @@ describe("/admin/shipping-options", () => {
|
|||||||
|
|
||||||
describe("POST /admin/shipping-options/:id", () => {
|
describe("POST /admin/shipping-options/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await shippingOptionSeeder(dbConnection)
|
await shippingOptionSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -254,7 +249,6 @@ describe("/admin/shipping-options", () => {
|
|||||||
let payload
|
let payload
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await shippingOptionSeeder(dbConnection)
|
await shippingOptionSeeder(dbConnection)
|
||||||
|
|
||||||
@@ -285,10 +279,6 @@ describe("/admin/shipping-options", () => {
|
|||||||
data: {},
|
data: {},
|
||||||
profile_id: defaultProfile.id,
|
profile_id: defaultProfile.id,
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -385,13 +375,8 @@ describe("/admin/shipping-options", () => {
|
|||||||
})
|
})
|
||||||
describe("GET /admin/shipping-options", () => {
|
describe("GET /admin/shipping-options", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await shippingOptionSeeder(dbConnection)
|
await shippingOptionSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,13 +28,9 @@ describe("/admin/swaps", () => {
|
|||||||
|
|
||||||
describe("GET /admin/swaps/:id", () => {
|
describe("GET /admin/swaps/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -106,13 +102,9 @@ describe("/admin/swaps", () => {
|
|||||||
|
|
||||||
describe("GET /admin/swaps/", () => {
|
describe("GET /admin/swaps/", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ describe("/admin/products", () => {
|
|||||||
|
|
||||||
describe("GET /admin/product-variants", () => {
|
describe("GET /admin/product-variants", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const adminReqConfig = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setupJobDb = async (dbConnection) => {
|
const setupJobDb = async (dbConnection) => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await userSeeder(dbConnection)
|
await userSeeder(dbConnection)
|
||||||
|
|
||||||
@@ -50,10 +49,6 @@ const setupJobDb = async (dbConnection) => {
|
|||||||
completed_at: "2022-06-27T22:00:00.000Z",
|
completed_at: "2022-06-27T22:00:00.000Z",
|
||||||
created_by: "admin_user",
|
created_by: "admin_user",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("/admin/batch-jobs", () => {
|
describe("/admin/batch-jobs", () => {
|
||||||
@@ -251,7 +246,6 @@ describe("/admin/batch-jobs", () => {
|
|||||||
|
|
||||||
describe("POST /admin/batch-jobs/:id/cancel", () => {
|
describe("POST /admin/batch-jobs/:id/cancel", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await setupJobDb(dbConnection)
|
await setupJobDb(dbConnection)
|
||||||
await simpleBatchJobFactory(dbConnection, {
|
await simpleBatchJobFactory(dbConnection, {
|
||||||
id: "job_complete",
|
id: "job_complete",
|
||||||
@@ -259,10 +253,6 @@ describe("/admin/batch-jobs", () => {
|
|||||||
created_by: "admin_user",
|
created_by: "admin_user",
|
||||||
completed_at: new Date(),
|
completed_at: new Date(),
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -47,14 +47,9 @@ describe("Batchjob with type order-export", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await userSeeder(dbConnection)
|
await userSeeder(dbConnection)
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -47,14 +47,9 @@ describe("Batch job of product-export type", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await userSeeder(dbConnection)
|
await userSeeder(dbConnection)
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -24,12 +24,8 @@ describe("Claims", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ describe("Line Item - Sales Channel", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
const [process, connection] = await startServerWithEnvironment({
|
const [process, connection] = await startServerWithEnvironment({
|
||||||
cwd,
|
cwd,
|
||||||
env: { MEDUSA_FF_SALES_CHANNELS: true },
|
env: { MEDUSA_FF_SALES_CHANNELS: true },
|
||||||
@@ -28,9 +27,6 @@ describe("Line Item - Sales Channel", () => {
|
|||||||
})
|
})
|
||||||
dbConnection = connection
|
dbConnection = connection
|
||||||
medusaProcess = process
|
medusaProcess = process
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@@ -40,7 +36,6 @@ describe("Line Item - Sales Channel", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await simpleProductFactory(dbConnection, {
|
await simpleProductFactory(dbConnection, {
|
||||||
id: "test-product-in-sales-channel",
|
id: "test-product-in-sales-channel",
|
||||||
title: "test product belonging to a channel",
|
title: "test product belonging to a channel",
|
||||||
@@ -83,10 +78,6 @@ describe("Line Item - Sales Channel", () => {
|
|||||||
id: "main-sales-channel",
|
id: "main-sales-channel",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -22,12 +22,8 @@ describe("Line Item Adjustments", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@@ -41,7 +37,6 @@ describe("Line Item Adjustments", () => {
|
|||||||
discount,
|
discount,
|
||||||
lineItemId = "line-test"
|
lineItemId = "line-test"
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await cartSeeder(dbConnection)
|
await cartSeeder(dbConnection)
|
||||||
discount = await simpleDiscountFactory(dbConnection, {
|
discount = await simpleDiscountFactory(dbConnection, {
|
||||||
code: "MEDUSATEST",
|
code: "MEDUSATEST",
|
||||||
@@ -91,10 +86,6 @@ describe("Line Item Adjustments", () => {
|
|||||||
},
|
},
|
||||||
100
|
100
|
||||||
)
|
)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ describe("Promotions", () => {
|
|||||||
|
|
||||||
describe("Money amount", () => {
|
describe("Money amount", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await promotionsSeeder(dbConnection)
|
await promotionsSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -23,12 +23,8 @@ describe("/admin/orders", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -46,12 +46,8 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd, verbose: false })
|
medusaProcess = await setupServer({ cwd, verbose: false })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@@ -207,13 +203,8 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
describe("POST /store/carts/:id/line-items", () => {
|
describe("POST /store/carts/:id/line-items", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await cartSeeder(dbConnection)
|
await cartSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -495,12 +486,7 @@ describe("/store/carts", () => {
|
|||||||
let discountCart
|
let discountCart
|
||||||
let discount
|
let discount
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
discount = await simpleDiscountFactory(dbConnection, discountData, 100)
|
||||||
discount = await simpleDiscountFactory(
|
|
||||||
dbConnection,
|
|
||||||
discountData,
|
|
||||||
100
|
|
||||||
)
|
|
||||||
discountCart = await simpleCartFactory(
|
discountCart = await simpleCartFactory(
|
||||||
dbConnection,
|
dbConnection,
|
||||||
{
|
{
|
||||||
@@ -543,9 +529,6 @@ describe("/store/carts", () => {
|
|||||||
.relation(Cart, "discounts")
|
.relation(Cart, "discounts")
|
||||||
.of(discountCart)
|
.of(discountCart)
|
||||||
.add(discount)
|
.add(discount)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -699,13 +682,8 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
describe("POST /store/carts/:id/line-items/:line_id", () => {
|
describe("POST /store/carts/:id/line-items/:line_id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await cartSeeder(dbConnection)
|
await cartSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -901,13 +879,8 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
describe("POST /store/carts/:id", () => {
|
describe("POST /store/carts/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await cartSeeder(dbConnection)
|
await cartSeeder(dbConnection)
|
||||||
await swapSeeder(dbConnection)
|
await swapSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -1738,11 +1711,7 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
try {
|
|
||||||
await api.post(`/store/carts/swap-cart/complete-cart`)
|
await api.post(`/store/carts/swap-cart/complete-cart`)
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// check to see if payment is authorized and cart is completed
|
// check to see if payment is authorized and cart is completed
|
||||||
const res = await api.get(`/store/carts/swap-cart`)
|
const res = await api.get(`/store/carts/swap-cart`)
|
||||||
@@ -1753,7 +1722,6 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
describe("POST /store/carts/:id/shipping-methods", () => {
|
describe("POST /store/carts/:id/shipping-methods", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await cartSeeder(dbConnection)
|
await cartSeeder(dbConnection)
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
|
|
||||||
@@ -1779,9 +1747,6 @@ describe("/store/carts", () => {
|
|||||||
shipping_option_id: "test-option",
|
shipping_option_id: "test-option",
|
||||||
price: 5,
|
price: 5,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -2059,12 +2024,7 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
describe("shipping address + region updates", () => {
|
describe("shipping address + region updates", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await cartSeeder(dbConnection)
|
await cartSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -25,12 +25,7 @@ describe("/store/collections", () => {
|
|||||||
|
|
||||||
describe("/store/collections/:id", () => {
|
describe("/store/collections/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -55,12 +50,7 @@ describe("/store/collections", () => {
|
|||||||
|
|
||||||
describe("/store/collections", () => {
|
describe("/store/collections", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -27,12 +27,7 @@ describe("/store/carts (draft-orders)", () => {
|
|||||||
|
|
||||||
describe("POST /admin/draft-order", () => {
|
describe("POST /admin/draft-order", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await draftOrderSeeder(dbConnection)
|
await draftOrderSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ describe("/store/variants", () => {
|
|||||||
|
|
||||||
describe("GET /store/variants", () => {
|
describe("GET /store/variants", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
|
|
||||||
await simpleProductFactory(
|
await simpleProductFactory(
|
||||||
@@ -46,10 +45,6 @@ describe("/store/variants", () => {
|
|||||||
},
|
},
|
||||||
100
|
100
|
||||||
)
|
)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -169,7 +164,6 @@ describe("/store/variants", () => {
|
|||||||
|
|
||||||
describe("GET /store/variants advanced pricing", () => {
|
describe("GET /store/variants advanced pricing", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await storeProductSeeder(dbConnection)
|
await storeProductSeeder(dbConnection)
|
||||||
|
|
||||||
await simpleProductFactory(
|
await simpleProductFactory(
|
||||||
@@ -189,10 +183,6 @@ describe("/store/variants", () => {
|
|||||||
},
|
},
|
||||||
100
|
100
|
||||||
)
|
)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -26,13 +26,8 @@ describe("/store/products", () => {
|
|||||||
|
|
||||||
describe("GET /store/products", () => {
|
describe("GET /store/products", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -233,13 +228,8 @@ describe("/store/products", () => {
|
|||||||
|
|
||||||
describe("list params", () => {
|
describe("list params", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -332,7 +322,6 @@ describe("/store/products", () => {
|
|||||||
|
|
||||||
describe("list params", () => {
|
describe("list params", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
await simpleProductFactory(
|
await simpleProductFactory(
|
||||||
@@ -354,10 +343,6 @@ describe("/store/products", () => {
|
|||||||
},
|
},
|
||||||
12
|
12
|
||||||
)
|
)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -400,13 +385,8 @@ describe("/store/products", () => {
|
|||||||
|
|
||||||
describe("/store/products/:id", () => {
|
describe("/store/products/:id", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await productSeeder(dbConnection)
|
await productSeeder(dbConnection)
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ describe("/store/return-reasons", () => {
|
|||||||
let rrId
|
let rrId
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
const created = dbConnection.manager.create(ReturnReason, {
|
const created = dbConnection.manager.create(ReturnReason, {
|
||||||
value: "wrong_size",
|
value: "wrong_size",
|
||||||
label: "Wrong size",
|
label: "Wrong size",
|
||||||
@@ -36,10 +35,6 @@ describe("/store/return-reasons", () => {
|
|||||||
|
|
||||||
const result = await dbConnection.manager.save(created)
|
const result = await dbConnection.manager.save(created)
|
||||||
rrId = result.id
|
rrId = result.id
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -73,7 +68,6 @@ describe("/store/return-reasons", () => {
|
|||||||
let rrId_2
|
let rrId_2
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
const created = dbConnection.manager.create(ReturnReason, {
|
const created = dbConnection.manager.create(ReturnReason, {
|
||||||
value: "wrong_size",
|
value: "wrong_size",
|
||||||
label: "Wrong size",
|
label: "Wrong size",
|
||||||
@@ -98,10 +92,6 @@ describe("/store/return-reasons", () => {
|
|||||||
|
|
||||||
const result_2 = await dbConnection.manager.save(created_2)
|
const result_2 = await dbConnection.manager.save(created_2)
|
||||||
rrId_2 = result_2.id
|
rrId_2 = result_2.id
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ const { useDb } = require("../../../helpers/use-db")
|
|||||||
const adminSeeder = require("../../helpers/admin-seeder")
|
const adminSeeder = require("../../helpers/admin-seeder")
|
||||||
const {
|
const {
|
||||||
simpleSalesChannelFactory,
|
simpleSalesChannelFactory,
|
||||||
simpleCartFactory, simpleRegionFactory, simpleProductFactory,
|
simpleCartFactory,
|
||||||
|
simpleRegionFactory,
|
||||||
|
simpleProductFactory,
|
||||||
} = require("../../factories")
|
} = require("../../factories")
|
||||||
|
|
||||||
const startServerWithEnvironment =
|
const startServerWithEnvironment =
|
||||||
@@ -47,7 +49,6 @@ describe("sales channels", () => {
|
|||||||
let disabledSalesChannel
|
let disabledSalesChannel
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await simpleRegionFactory(dbConnection, {
|
await simpleRegionFactory(dbConnection, {
|
||||||
name: "Test region",
|
name: "Test region",
|
||||||
@@ -56,7 +57,7 @@ describe("sales channels", () => {
|
|||||||
await simpleSalesChannelFactory(dbConnection, {
|
await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "Default Sales Channel",
|
name: "Default Sales Channel",
|
||||||
description: "Created by Medusa",
|
description: "Created by Medusa",
|
||||||
is_default: true
|
is_default: true,
|
||||||
})
|
})
|
||||||
disabledSalesChannel = await simpleSalesChannelFactory(dbConnection, {
|
disabledSalesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||||
name: "disabled cart sales channel",
|
name: "disabled cart sales channel",
|
||||||
@@ -67,9 +68,6 @@ describe("sales channels", () => {
|
|||||||
name: "cart sales channel",
|
name: "cart sales channel",
|
||||||
description: "cart sales channel description",
|
description: "cart sales channel description",
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -94,7 +92,11 @@ describe("sales channels", () => {
|
|||||||
it("returns a cart with the given sales channel", async () => {
|
it("returns a cart with the given sales channel", async () => {
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
const response = await api.post(`/store/carts`, { sales_channel_id: salesChannel.id }, adminReqConfig)
|
const response = await api.post(
|
||||||
|
`/store/carts`,
|
||||||
|
{ sales_channel_id: salesChannel.id },
|
||||||
|
adminReqConfig
|
||||||
|
)
|
||||||
|
|
||||||
expect(response.data.cart.sales_channel).toBeTruthy()
|
expect(response.data.cart.sales_channel).toBeTruthy()
|
||||||
expect(response.data.cart.sales_channel).toEqual(
|
expect(response.data.cart.sales_channel).toEqual(
|
||||||
@@ -108,14 +110,18 @@ describe("sales channels", () => {
|
|||||||
it("throw if the given sales channel is disabled", async () => {
|
it("throw if the given sales channel is disabled", async () => {
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
const err = await api.post(
|
const err = await api
|
||||||
|
.post(
|
||||||
`/store/carts`,
|
`/store/carts`,
|
||||||
{ sales_channel_id: disabledSalesChannel.id },
|
{ sales_channel_id: disabledSalesChannel.id },
|
||||||
adminReqConfig
|
adminReqConfig
|
||||||
).catch(err => err)
|
)
|
||||||
|
.catch((err) => err)
|
||||||
|
|
||||||
expect(err.response.status).toEqual(400)
|
expect(err.response.status).toEqual(400)
|
||||||
expect(err.response.data.message).toBe(`Unable to assign the cart to a disabled Sales Channel "disabled cart sales channel"`)
|
expect(err.response.data.message).toBe(
|
||||||
|
`Unable to assign the cart to a disabled Sales Channel "disabled cart sales channel"`
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -125,7 +131,6 @@ describe("sales channels", () => {
|
|||||||
let cart
|
let cart
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
await simpleRegionFactory(dbConnection, {
|
await simpleRegionFactory(dbConnection, {
|
||||||
name: "Test region",
|
name: "Test region",
|
||||||
@@ -147,9 +152,7 @@ describe("sales channels", () => {
|
|||||||
is_disabled: true,
|
is_disabled: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
product1 = await simpleProductFactory(
|
product1 = await simpleProductFactory(dbConnection, {
|
||||||
dbConnection,
|
|
||||||
{
|
|
||||||
title: "prod 1",
|
title: "prod 1",
|
||||||
sales_channels: [salesChannel1],
|
sales_channels: [salesChannel1],
|
||||||
variants: [
|
variants: [
|
||||||
@@ -164,11 +167,8 @@ describe("sales channels", () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
})
|
||||||
)
|
product2 = await simpleProductFactory(dbConnection, {
|
||||||
product2 = await simpleProductFactory(
|
|
||||||
dbConnection,
|
|
||||||
{
|
|
||||||
sales_channels: [salesChannel2],
|
sales_channels: [salesChannel2],
|
||||||
variants: [
|
variants: [
|
||||||
{
|
{
|
||||||
@@ -182,12 +182,9 @@ describe("sales channels", () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
cart = await simpleCartFactory(
|
cart = await simpleCartFactory(dbConnection, {
|
||||||
dbConnection,
|
|
||||||
{
|
|
||||||
sales_channel: salesChannel1,
|
sales_channel: salesChannel1,
|
||||||
line_items: [
|
line_items: [
|
||||||
{
|
{
|
||||||
@@ -195,11 +192,7 @@ describe("sales channels", () => {
|
|||||||
unit_price: 50,
|
unit_price: 50,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
})
|
||||||
)
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -207,9 +200,7 @@ describe("sales channels", () => {
|
|||||||
await db.teardown()
|
await db.teardown()
|
||||||
})
|
})
|
||||||
|
|
||||||
it(
|
it("updates a cart sales channels should remove the items that does not belongs to the new sales channel", async () => {
|
||||||
"updates a cart sales channels should remove the items that does not belongs to the new sales channel",
|
|
||||||
async () => {
|
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
let response = await api.get(`/store/carts/${cart.id}`, adminReqConfig)
|
let response = await api.get(`/store/carts/${cart.id}`, adminReqConfig)
|
||||||
@@ -229,7 +220,11 @@ describe("sales channels", () => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
response = await api.post(`/store/carts/${cart.id}`, { sales_channel_id: salesChannel2.id }, adminReqConfig)
|
response = await api.post(
|
||||||
|
`/store/carts/${cart.id}`,
|
||||||
|
{ sales_channel_id: salesChannel2.id },
|
||||||
|
adminReqConfig
|
||||||
|
)
|
||||||
|
|
||||||
expect(response.data.cart.sales_channel).toBeTruthy()
|
expect(response.data.cart.sales_channel).toBeTruthy()
|
||||||
expect(response.data.cart.sales_channel).toEqual(
|
expect(response.data.cart.sales_channel).toEqual(
|
||||||
@@ -239,20 +234,23 @@ describe("sales channels", () => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
expect(response.data.cart.items.length).toBe(0)
|
expect(response.data.cart.items.length).toBe(0)
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
it("throw if the given sales channel is disabled", async () => {
|
it("throw if the given sales channel is disabled", async () => {
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
const err = await api.post(
|
const err = await api
|
||||||
|
.post(
|
||||||
`/store/carts/${cart.id}`,
|
`/store/carts/${cart.id}`,
|
||||||
{ sales_channel_id: disabledSalesChannel.id },
|
{ sales_channel_id: disabledSalesChannel.id },
|
||||||
adminReqConfig
|
adminReqConfig
|
||||||
).catch(err => err)
|
)
|
||||||
|
.catch((err) => err)
|
||||||
|
|
||||||
expect(err.response.status).toEqual(400)
|
expect(err.response.status).toEqual(400)
|
||||||
expect(err.response.data.message).toBe("Unable to assign the cart to a disabled Sales Channel \"disabled cart sales channel\"")
|
expect(err.response.data.message).toBe(
|
||||||
|
`Unable to assign the cart to a disabled Sales Channel "disabled cart sales channel"`
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -260,7 +258,6 @@ describe("sales channels", () => {
|
|||||||
let cart
|
let cart
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
|
|
||||||
cart = await simpleCartFactory(dbConnection, {
|
cart = await simpleCartFactory(dbConnection, {
|
||||||
@@ -269,9 +266,6 @@ describe("sales channels", () => {
|
|||||||
description: "test description",
|
description: "test description",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
const path = require("path")
|
const path = require("path")
|
||||||
const {
|
const { ShippingProfile, ShippingOption } = require("@medusajs/medusa")
|
||||||
ShippingProfile,
|
|
||||||
ShippingOption,
|
|
||||||
} = require("@medusajs/medusa")
|
|
||||||
|
|
||||||
const setupServer = require("../../../helpers/setup-server")
|
const setupServer = require("../../../helpers/setup-server")
|
||||||
const { useApi } = require("../../../helpers/use-api")
|
const { useApi } = require("../../../helpers/use-api")
|
||||||
@@ -30,7 +27,6 @@ describe("/store/carts", () => {
|
|||||||
|
|
||||||
describe("/store/swaps", () => {
|
describe("/store/swaps", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await orderSeeder(dbConnection)
|
await orderSeeder(dbConnection)
|
||||||
|
|
||||||
const manager = dbConnection.manager
|
const manager = dbConnection.manager
|
||||||
@@ -55,10 +51,6 @@ describe("/store/carts", () => {
|
|||||||
amount: 1000,
|
amount: 1000,
|
||||||
is_return: true,
|
is_return: true,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -25,12 +25,8 @@ describe("Swaps", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -26,12 +26,8 @@ describe("/admin/tax-rates", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -27,12 +27,8 @@ describe("Automatic Cart Taxes", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -32,12 +32,7 @@ describe("Cart Totals Calculations", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -26,12 +26,8 @@ describe("Manual Cart Taxes", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -25,12 +25,8 @@ describe("Order Taxes", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -32,12 +32,7 @@ describe("Shipping Options Totals Calculations", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -25,12 +25,8 @@ describe("Order Totals", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
medusaProcess = await setupServer({ cwd })
|
medusaProcess = await setupServer({ cwd })
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --silent=false",
|
"test": "jest --silent=false --runInBand --bail",
|
||||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
-4
@@ -5,7 +5,6 @@ const importFrom = require("import-from")
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
bootstrapApp: async ({ cwd } = {}) => {
|
bootstrapApp: async ({ cwd } = {}) => {
|
||||||
try {
|
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
const loaders = importFrom(
|
const loaders = importFrom(
|
||||||
@@ -27,8 +26,5 @@ module.exports = {
|
|||||||
app,
|
app,
|
||||||
port: PORT,
|
port: PORT,
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,6 @@ class DatabaseFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createTemplateDb_({ cwd }) {
|
async createTemplateDb_({ cwd }) {
|
||||||
try {
|
|
||||||
// const cwd = path.resolve(path.join(__dirname, ".."))
|
// const cwd = path.resolve(path.join(__dirname, ".."))
|
||||||
const connection = await this.getMasterConnection()
|
const connection = await this.getMasterConnection()
|
||||||
const migrationDir = path.resolve(
|
const migrationDir = path.resolve(
|
||||||
@@ -79,10 +78,6 @@ class DatabaseFactory {
|
|||||||
await templateDbConnection.close()
|
await templateDbConnection.close()
|
||||||
|
|
||||||
return connection
|
return connection
|
||||||
} catch (err) {
|
|
||||||
console.log("error in createTemplateDb_")
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMasterConnection() {
|
async getMasterConnection() {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ describe("medusa-plugin-sendgrid", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||||
try {
|
|
||||||
dbConnection = await initDb({ cwd })
|
dbConnection = await initDb({ cwd })
|
||||||
const { container, app, port } = await bootstrapApp({ cwd })
|
const { container, app, port } = await bootstrapApp({ cwd })
|
||||||
appContainer = container
|
appContainer = container
|
||||||
@@ -36,10 +35,6 @@ describe("medusa-plugin-sendgrid", () => {
|
|||||||
express = app.listen(port, (err) => {
|
express = app.listen(port, (err) => {
|
||||||
process.send(port)
|
process.send(port)
|
||||||
})
|
})
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|||||||
+4
-4
@@ -64,10 +64,10 @@
|
|||||||
"jest": "jest",
|
"jest": "jest",
|
||||||
"test": "turbo run test",
|
"test": "turbo run test",
|
||||||
"prettier": "prettier",
|
"prettier": "prettier",
|
||||||
"test:integration": "NODE_ENV=test jest --runInBand --config=integration-tests/jest.config.js",
|
"test:integration": "NODE_ENV=test jest --runInBand --bail --config=integration-tests/jest.config.js",
|
||||||
"test:integration:api": "NODE_ENV=test jest --runInBand --config=integration-tests/jest.config.js --projects=integration-tests/api",
|
"test:integration:api": "NODE_ENV=test jest --runInBand --bail --config=integration-tests/jest.config.js --projects=integration-tests/api",
|
||||||
"test:integration:plugins": "NODE_ENV=test jest --runInBand --config=integration-tests/jest.config.js --projects=integration-tests/plugins",
|
"test:integration:plugins": "NODE_ENV=test jest --runInBand --bail --config=integration-tests/jest.config.js --projects=integration-tests/plugins",
|
||||||
"test:fixtures": "NODE_ENV=test jest --config=docs-util/jest.config.js --runInBand",
|
"test:fixtures": "NODE_ENV=test jest --config=docs-util/jest.config.js --runInBand --bail",
|
||||||
"openapi:generate": "node ./scripts/build-openapi.js",
|
"openapi:generate": "node ./scripts/build-openapi.js",
|
||||||
"generate:services": "typedoc --options typedoc.services.js",
|
"generate:services": "typedoc --options typedoc.services.js",
|
||||||
"generate:js-client": "typedoc --options typedoc.js-client.js",
|
"generate:js-client": "typedoc --options typedoc.js-client.js",
|
||||||
|
|||||||
Reference in new issue
Block a user