feat(medusa): Add batch strategy for order exports (#1603)
This commit is contained in:
@@ -63,7 +63,7 @@ describe("/admin/batch-jobs", () => {
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd, verbose: false })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -131,19 +131,19 @@ describe("/admin/batch-jobs", () => {
|
||||
id: "job_3",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
created_by: "admin_user"
|
||||
created_by: "admin_user",
|
||||
},
|
||||
{
|
||||
id: "job_2",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
created_by: "admin_user"
|
||||
created_by: "admin_user",
|
||||
},
|
||||
{
|
||||
id: "job_1",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
created_by: "admin_user"
|
||||
created_by: "admin_user",
|
||||
},
|
||||
],
|
||||
})
|
||||
@@ -165,23 +165,24 @@ describe("/admin/batch-jobs", () => {
|
||||
const response = await api.get("/admin/batch-jobs/job_1", adminReqConfig)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.batch_job).toEqual(expect.objectContaining({
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
created_by: "admin_user"
|
||||
}))
|
||||
expect(response.data.batch_job).toEqual(
|
||||
expect.objectContaining({
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
created_by: "admin_user",
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should fail on batch job created by other user", async () => {
|
||||
const api = useApi()
|
||||
await api.get("/admin/batch-jobs/job_4", adminReqConfig)
|
||||
.catch((err) => {
|
||||
expect(err.response.status).toEqual(400)
|
||||
expect(err.response.data.type).toEqual("not_allowed")
|
||||
expect(err.response.data.message).toEqual(
|
||||
"Cannot access a batch job that does not belong to the logged in user"
|
||||
)
|
||||
})
|
||||
await api.get("/admin/batch-jobs/job_4", adminReqConfig).catch((err) => {
|
||||
expect(err.response.status).toEqual(400)
|
||||
expect(err.response.data.type).toEqual("not_allowed")
|
||||
expect(err.response.data.message).toEqual(
|
||||
"Cannot access a batch job that does not belong to the logged in user"
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -195,7 +196,7 @@ describe("/admin/batch-jobs", () => {
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("Creates a batch job", async() => {
|
||||
it("Creates a batch job", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.post(
|
||||
@@ -261,7 +262,7 @@ describe("/admin/batch-jobs", () => {
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async() => {
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user