feat(medusa/product-export-strategy): Implement the Product export strategy (#1688)

This commit is contained in:
Adrien de Peretti
2022-06-22 23:42:31 +02:00
committed by GitHub
parent 0e34800573
commit 7b09b8c36c
26 changed files with 2017 additions and 106 deletions
@@ -24,25 +24,23 @@ const setupJobDb = async (dbConnection) => {
await simpleBatchJobFactory(dbConnection, {
id: "job_1",
type: "batch_1",
type: "product-export",
created_by: "admin_user",
})
await simpleBatchJobFactory(dbConnection, {
id: "job_2",
type: "batch_2",
ready_at: new Date(),
type: "product-export",
created_by: "admin_user",
})
await simpleBatchJobFactory(dbConnection, {
id: "job_3",
type: "batch_2",
ready_at: new Date(),
type: "product-export",
created_by: "admin_user",
})
await simpleBatchJobFactory(dbConnection, {
id: "job_4",
type: "batch_1",
ready_at: new Date(),
type: "product-export",
status: "awaiting_confirmation",
created_by: "member-user",
})
} catch (err) {
@@ -142,16 +140,11 @@ describe("/admin/batch-jobs", () => {
})
describe("POST /admin/batch-jobs/", () => {
beforeEach(async() => {
try {
await adminSeeder(dbConnection)
} catch (err) {
console.log(err)
throw err
}
beforeEach(async () => {
await setupJobDb(dbConnection)
})
afterEach(async() => {
afterEach(async () => {
const db = useDb()
await db.teardown()
})
@@ -162,7 +155,7 @@ describe("/admin/batch-jobs", () => {
const response = await api.post(
"/admin/batch-jobs",
{
type: "batch_1",
type: "product-export",
context: {},
},
adminReqConfig
@@ -212,7 +205,7 @@ describe("/admin/batch-jobs", () => {
await setupJobDb(dbConnection)
await simpleBatchJobFactory(dbConnection, {
id: "job_complete",
type: "batch_1",
type: "product-export",
created_by: "admin_user",
completed_at: new Date(),
})
@@ -222,7 +215,7 @@ describe("/admin/batch-jobs", () => {
}
})
afterEach(async () => {
afterEach(async() => {
const db = useDb()
await db.teardown()
})