feat(medusa): Authentication overhaul (#4064)
* implemented bearer auth * changed naming strat * changed session auth to not use jwt * typo * changed auth header prefix for admin api token auth * fixed supporting functions to work with new session type * removed database calls for bearer auth improving performance * removed unused deps * changed auth in tests * added integration tests * Accepted suggested change Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> * Typo Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * more typos Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * proper formatting Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * removed endregion Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * removed startregion Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * fixed admin JWT integration test * added more fixes to integration tests * Update OAS * Create fluffy-donkeys-hope.md * created API reference for new auth * implemented getToken in medusa-js * Apply suggestions from code review Co-authored-by: Shahed Nasser <shahednasser@gmail.com> * Apply suggestions from code review Co-authored-by: Shahed Nasser <shahednasser@gmail.com> * deleted files which should be autogenerated * Update fluffy-donkeys-hope.md * JSDoc update Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> * added missing route exports * implemented runtime domain safety in jwt token manager * fixed jwt manager * lint get-token files * Update fluffy-donkeys-hope.md * Revert "deleted files which should be autogenerated" This reverts commit cd5e86623b822e6a6ac37322b952143ccc493df9. * Revert "Apply suggestions from code review" This reverts commit f02f07ce58fd9fcc2dfc80cadbb9df2665108d65. * Revert "created API reference for new auth" This reverts commit c9eafbb36453f5cf8047c79e94f470cb2d023c7d. * renamed header for sending api access tokens * medusa-js - changed apiKey header --------- Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> Co-authored-by: olivermrbl <oliver@mrbltech.com> Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ const adminSeeder = require("../../../helpers/admin-seeder")
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -47,4 +47,20 @@ describe("/admin/auth", () => {
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
})
|
||||
|
||||
it("creates admin JWT token correctly", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post("/admin/auth/token", {
|
||||
email: "admin@medusa.js",
|
||||
password: "secret_password",
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.access_token).toEqual(expect.any(String))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -18,7 +18,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ describe("/admin/collections", () => {
|
||||
{
|
||||
title: "test",
|
||||
},
|
||||
{ headers: { Authorization: "Bearer test_token" } }
|
||||
{ headers: { "x-medusa-access-token": "test_token" } }
|
||||
)
|
||||
|
||||
const response = await api.post(
|
||||
@@ -66,7 +66,7 @@ describe("/admin/collections", () => {
|
||||
title: "test collection creation",
|
||||
handle: "test-handle-creation",
|
||||
},
|
||||
{ headers: { Authorization: "Bearer test_token" } }
|
||||
{ headers: { "x-medusa-access-token": "test_token" } }
|
||||
)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
@@ -91,12 +91,12 @@ describe("/admin/collections", () => {
|
||||
{
|
||||
title: "test",
|
||||
},
|
||||
{ headers: { Authorization: "Bearer test_token" } }
|
||||
{ headers: { "x-medusa-access-token": "test_token" } }
|
||||
)
|
||||
|
||||
const response = await api.delete(
|
||||
`/admin/collections/${creationResponse.data.collection.id}`,
|
||||
{ headers: { Authorization: "Bearer test_token" } }
|
||||
{ headers: { "x-medusa-access-token": "test_token" } }
|
||||
)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
@@ -111,7 +111,7 @@ describe("/admin/collections", () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.get("/admin/collections/test-collection", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
expect(response.data).toEqual(
|
||||
@@ -160,7 +160,7 @@ describe("/admin/collections", () => {
|
||||
title: "test collection creation",
|
||||
handle: "test-handle-creation",
|
||||
},
|
||||
{ headers: { Authorization: "Bearer test_token" } }
|
||||
{ headers: { "x-medusa-access-token": "test_token" } }
|
||||
)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
@@ -181,7 +181,7 @@ describe("/admin/collections", () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.get("/admin/collections", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
expect(response.data).toEqual(
|
||||
@@ -261,7 +261,7 @@ describe("/admin/collections", () => {
|
||||
product_ids: ["test-product_filtering_1"],
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
}
|
||||
)
|
||||
.catch((err) => console.warn(err))
|
||||
@@ -307,7 +307,7 @@ describe("/admin/collections", () => {
|
||||
|
||||
const response = await api
|
||||
.delete("/admin/collections/test-collection/products/batch", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
data: { product_ids: ["test-product"] },
|
||||
})
|
||||
.catch((err) => console.warn(err))
|
||||
@@ -328,7 +328,7 @@ describe("/admin/collections", () => {
|
||||
|
||||
const response = await api
|
||||
.get("/admin/collections?title=Test%20collection", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const adminSeeder = require("../../../helpers/admin-seeder")
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -76,7 +76,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers?has_account=true", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -97,7 +97,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers?groups[]=test-group-5", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -127,7 +127,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers?q=est2@", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -152,7 +152,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers?q=test1@email.com&expand=shipping_addresses", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -202,7 +202,7 @@ describe("/admin/customers", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -246,7 +246,7 @@ describe("/admin/customers", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -278,7 +278,7 @@ describe("/admin/customers", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -301,7 +301,7 @@ describe("/admin/customers", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -329,7 +329,7 @@ describe("/admin/customers", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -350,7 +350,7 @@ describe("/admin/customers", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -389,7 +389,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers/test-customer-1", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -417,7 +417,7 @@ describe("/admin/customers", () => {
|
||||
const response = await api
|
||||
.get("/admin/customers/test-customer-1?expand=billing_address,groups", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@@ -20,7 +20,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ describe("/admin/discounts", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -770,7 +770,7 @@ describe("/admin/discounts", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1381,7 +1381,7 @@ describe("/admin/discounts", () => {
|
||||
|
||||
const resultingDiscount = await api.get(
|
||||
"/admin/discounts/test-discount",
|
||||
{ headers: { Authorization: "Bearer test_token" } }
|
||||
{ headers: { "x-medusa-access-token": "test_token" } }
|
||||
)
|
||||
|
||||
expect(resultingDiscount.status).toEqual(200)
|
||||
|
||||
@@ -12,7 +12,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ describe("/admin/gift-cards", () => {
|
||||
const response = await api
|
||||
.get("/admin/gift-cards", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -91,7 +91,7 @@ describe("/admin/gift-cards", () => {
|
||||
const response = await api
|
||||
.get("/admin/gift-cards?q=gc", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -116,7 +116,7 @@ describe("/admin/gift-cards", () => {
|
||||
const response = await api
|
||||
.get("/admin/gift-cards?q=bla", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -165,7 +165,7 @@ describe("/admin/gift-cards", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -192,7 +192,7 @@ describe("/admin/gift-cards", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ describe("/admin/invites", () => {
|
||||
const response = await api
|
||||
.get("/admin/invites", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -92,7 +92,7 @@ describe("/admin/invites", () => {
|
||||
password: "test123453",
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
}
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
@@ -116,14 +116,14 @@ describe("/admin/invites", () => {
|
||||
|
||||
const createReponse = await api
|
||||
.post("/admin/invites", payload, {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
const response = await api
|
||||
.get("/admin/invites", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -151,14 +151,14 @@ describe("/admin/invites", () => {
|
||||
|
||||
const createReponse = await api
|
||||
.post("/admin/invites", payload, {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
const response = await api
|
||||
.get("/admin/invites", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -189,7 +189,7 @@ describe("/admin/invites", () => {
|
||||
`/admin/invites/${id}/resend`,
|
||||
{},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
}
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
@@ -201,7 +201,7 @@ describe("/admin/invites", () => {
|
||||
const api = useApi()
|
||||
|
||||
const inviteResponse = await api.get("/admin/invites", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
const { token, ...rest } = inviteResponse.data.invites[0]
|
||||
@@ -219,7 +219,7 @@ describe("/admin/invites", () => {
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
const userResponse = await api.get("/admin/users", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
const newUser = userResponse.data.users.find(
|
||||
@@ -234,7 +234,7 @@ describe("/admin/invites", () => {
|
||||
const api = useApi()
|
||||
|
||||
const inviteResponse = await api.get("/admin/invites", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
const { token, ...rest } = inviteResponse.data.invites.find(
|
||||
@@ -254,7 +254,7 @@ describe("/admin/invites", () => {
|
||||
|
||||
const updateResponse = await api
|
||||
.post("/admin/invites", updatePayload, {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
@@ -263,7 +263,7 @@ describe("/admin/invites", () => {
|
||||
const createResponse = await api.post("/admin/invites/accept", payload)
|
||||
|
||||
const userResponse = await api.get("/admin/users", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
const newUser = userResponse.data.users.find(
|
||||
@@ -302,7 +302,7 @@ describe("/admin/invites", () => {
|
||||
const api = useApi()
|
||||
|
||||
const inviteResponse = await api.get("/admin/invites", {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
const { token } = inviteResponse.data.invites[0]
|
||||
@@ -353,7 +353,7 @@ describe("/admin/invites", () => {
|
||||
|
||||
const invitesBeforeDeleteRequest = await api.get("/admin/invites", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -361,13 +361,13 @@ describe("/admin/invites", () => {
|
||||
|
||||
const response = await api
|
||||
.delete(`/admin/invites/${inviteId}`, {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
const invitesAfterDeleteRequest = await api.get("/admin/invites", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ describe("/admin/notes", () => {
|
||||
|
||||
const response = await api.get("/admin/notes/note1", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -91,7 +91,7 @@ describe("/admin/notes", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -136,7 +136,7 @@ describe("/admin/notes", () => {
|
||||
const response = await api
|
||||
.get("/admin/notes?resource_id=resource1", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -169,7 +169,7 @@ describe("/admin/notes", () => {
|
||||
const response = await api
|
||||
.get("/admin/notes?limit=2", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -204,7 +204,7 @@ describe("/admin/notes", () => {
|
||||
{ value: "new text" },
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -215,7 +215,7 @@ describe("/admin/notes", () => {
|
||||
const response = await api
|
||||
.get("/admin/notes/note1", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -246,7 +246,7 @@ describe("/admin/notes", () => {
|
||||
await api
|
||||
.delete("/admin/notes/note1", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -257,7 +257,7 @@ describe("/admin/notes", () => {
|
||||
await api
|
||||
.get("/admin/notes/note1", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => (error = err))
|
||||
|
||||
@@ -18,7 +18,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ const {
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ const productSeeder = require("../../../helpers/product-seeder")
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ jest.setTimeout(50000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ jest.setTimeout(50000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ jest.setTimeout(50000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const testProduct1Id = "test-product1"
|
||||
const testProductFilteringId1 = "test-product_filtering_1"
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ jest.setTimeout(50000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ describe("Publishable API keys", () => {
|
||||
|
||||
const response = await api.get(`/store/products`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -630,7 +630,7 @@ describe("Publishable API keys", () => {
|
||||
|
||||
const response = await api.get(`/store/products`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -666,7 +666,7 @@ describe("Publishable API keys", () => {
|
||||
`/store/products?sales_channel_id[0]=${salesChannel2.id}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
}
|
||||
@@ -698,7 +698,7 @@ describe("Publishable API keys", () => {
|
||||
|
||||
const response = await api.get(`/store/products`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
// "x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -718,7 +718,7 @@ describe("Publishable API keys", () => {
|
||||
|
||||
const response = await api.get(`/store/products`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -755,7 +755,7 @@ describe("Publishable API keys", () => {
|
||||
`/store/products?sales_channel_id[]=${salesChannel2.id}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
}
|
||||
@@ -819,7 +819,7 @@ describe("Publishable API keys", () => {
|
||||
|
||||
const response = await api.get(`/store/products/${product1.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -845,7 +845,7 @@ describe("Publishable API keys", () => {
|
||||
const response = await api
|
||||
.get(`/store/products/${product2.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -862,7 +862,7 @@ describe("Publishable API keys", () => {
|
||||
let response = await api
|
||||
.get(`/store/products/${product1.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -875,7 +875,7 @@ describe("Publishable API keys", () => {
|
||||
response = await api
|
||||
.get(`/store/products/${product2.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
})
|
||||
@@ -952,7 +952,7 @@ describe("Publishable API keys", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
}
|
||||
@@ -1011,7 +1011,7 @@ describe("Publishable API keys", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
}
|
||||
@@ -1064,7 +1064,7 @@ describe("Publishable API keys", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
"x-publishable-api-key": pubKeyId,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const { simpleRegionFactory } = require("../../../factories")
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ describe("/admin/regions", () => {
|
||||
const response = await api
|
||||
.delete(`/admin/regions/test-region`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -87,7 +87,7 @@ describe("/admin/regions", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -159,7 +159,7 @@ describe("/admin/regions", () => {
|
||||
const response = await api
|
||||
.get(`/admin/regions`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -188,7 +188,7 @@ describe("/admin/regions", () => {
|
||||
|
||||
const response = await api.get(`/admin/regions?limit=2`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -203,7 +203,7 @@ describe("/admin/regions", () => {
|
||||
const response = await api
|
||||
.get(`/admin/regions?updated_at[gt]=10-10-2005`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -257,7 +257,7 @@ describe("/admin/regions", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -265,7 +265,7 @@ describe("/admin/regions", () => {
|
||||
const response = await api
|
||||
.delete(`/admin/regions/test-region`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -296,7 +296,7 @@ describe("/admin/regions", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -80,7 +80,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -107,7 +107,7 @@ describe("/admin/return-reasons", () => {
|
||||
const nested_response = await api
|
||||
.post("/admin/return-reasons", nested_payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -141,7 +141,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -168,7 +168,7 @@ describe("/admin/return-reasons", () => {
|
||||
const nested_response = await api
|
||||
.post("/admin/return-reasons", nested_payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -185,7 +185,7 @@ describe("/admin/return-reasons", () => {
|
||||
const dbl_nested_response = await api
|
||||
.post("/admin/return-reasons", dbl_nested_payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -209,7 +209,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -229,7 +229,7 @@ describe("/admin/return-reasons", () => {
|
||||
const deleteResponse = await api
|
||||
.delete(`/admin/return-reasons/${response.data.return_reason.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -259,7 +259,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -285,7 +285,7 @@ describe("/admin/return-reasons", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -314,7 +314,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -331,7 +331,7 @@ describe("/admin/return-reasons", () => {
|
||||
const resp = await api
|
||||
.post("/admin/return-reasons", nested_payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -341,7 +341,7 @@ describe("/admin/return-reasons", () => {
|
||||
const nested_response = await api
|
||||
.get("/admin/return-reasons", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -381,7 +381,7 @@ describe("/admin/return-reasons", () => {
|
||||
await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -391,7 +391,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.get("/admin/return-reasons", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -439,7 +439,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -460,7 +460,7 @@ describe("/admin/return-reasons", () => {
|
||||
`/admin/return-reasons/${response.data.return_reason.id}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -476,7 +476,7 @@ describe("/admin/return-reasons", () => {
|
||||
const getResult = await api
|
||||
.get(`/admin/return-reasons/${response.data.return_reason.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -499,7 +499,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response = await api
|
||||
.post("/admin/return-reasons", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -526,7 +526,7 @@ describe("/admin/return-reasons", () => {
|
||||
const response_child = await api
|
||||
.post("/admin/return-reasons", payload_child, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -547,7 +547,7 @@ describe("/admin/return-reasons", () => {
|
||||
const deleteResult = await api
|
||||
.delete(`/admin/return-reasons/${response.data.return_reason.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -565,7 +565,7 @@ describe("/admin/return-reasons", () => {
|
||||
await api
|
||||
.get(`/admin/return-reasons/${response.data.return_reason.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -576,7 +576,7 @@ describe("/admin/return-reasons", () => {
|
||||
await api
|
||||
.get(`/admin/return-reasons/${response_child.data.return_reason.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const authHeader = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ describe("/admin/returns", () => {
|
||||
{},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ const startServerWithEnvironment =
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ describe("sales channels", () => {
|
||||
payload,
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -856,7 +856,7 @@ describe("sales channels", () => {
|
||||
`/admin/orders?sales_channel_id[]=${order.sales_channel_id}`,
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -904,7 +904,7 @@ describe("sales channels", () => {
|
||||
const response = await api
|
||||
.get(`/admin/products?sales_channel_id[]=${salesChannel.id}`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -964,7 +964,7 @@ describe("sales channels", () => {
|
||||
const response = await api
|
||||
.post("/admin/products", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -1005,7 +1005,7 @@ describe("sales channels", () => {
|
||||
const response = await api
|
||||
.post("/admin/products", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -1054,7 +1054,7 @@ describe("sales channels", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1077,7 +1077,7 @@ describe("sales channels", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1103,7 +1103,7 @@ describe("sales channels", () => {
|
||||
{},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1131,7 +1131,7 @@ describe("sales channels", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -1158,7 +1158,7 @@ describe("sales channels", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ const {
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ describe("/admin/shipping-options", () => {
|
||||
|
||||
const res = await api.post(`/admin/shipping-options/test-out`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -115,7 +115,7 @@ describe("/admin/shipping-options", () => {
|
||||
const res = await api
|
||||
.post(`/admin/shipping-options/test-out`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -150,7 +150,7 @@ describe("/admin/shipping-options", () => {
|
||||
const res = await api
|
||||
.post(`/admin/shipping-options/test-option-req`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -176,7 +176,7 @@ describe("/admin/shipping-options", () => {
|
||||
const res = await api
|
||||
.post(`/admin/shipping-options/test-option-req`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -207,7 +207,7 @@ describe("/admin/shipping-options", () => {
|
||||
const res = await api
|
||||
.post(`/admin/shipping-options/test-option-req`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -240,7 +240,7 @@ describe("/admin/shipping-options", () => {
|
||||
const res = await api
|
||||
.post(`/admin/shipping-options/test-option-req`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -269,7 +269,7 @@ describe("/admin/shipping-options", () => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -312,7 +312,7 @@ describe("/admin/shipping-options", () => {
|
||||
|
||||
const res = await api.post(`/admin/shipping-options`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -324,7 +324,7 @@ describe("/admin/shipping-options", () => {
|
||||
const api = useApi()
|
||||
const res = await api.post(`/admin/shipping-options`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -348,7 +348,7 @@ describe("/admin/shipping-options", () => {
|
||||
try {
|
||||
await api.post(`/admin/shipping-options`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
@@ -374,7 +374,7 @@ describe("/admin/shipping-options", () => {
|
||||
try {
|
||||
await api.post(`/admin/shipping-options`, payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
@@ -399,7 +399,7 @@ describe("/admin/shipping-options", () => {
|
||||
const api = useApi()
|
||||
const res = await api.get(`/admin/shipping-options`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -410,7 +410,7 @@ describe("/admin/shipping-options", () => {
|
||||
const api = useApi()
|
||||
const res = await api.get(`/admin/shipping-options?admin_only=true`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -429,7 +429,7 @@ describe("/admin/shipping-options", () => {
|
||||
const api = useApi()
|
||||
const res = await api.get(`/admin/shipping-options?is_return=true`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -450,7 +450,7 @@ describe("/admin/shipping-options", () => {
|
||||
`/admin/shipping-options?is_return=false&admin_only=true`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ const adminSeeder = require("../../../helpers/admin-seeder")
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ describe("/admin/store", () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.get("/admin/store", {
|
||||
headers: { Authorization: "Bearer test_token " },
|
||||
headers: { "x-medusa-access-token": "test_token " },
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
@@ -99,7 +99,7 @@ describe("/admin/store", () => {
|
||||
default_currency_code: "eur",
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token " },
|
||||
headers: { "x-medusa-access-token": "test_token " },
|
||||
}
|
||||
)
|
||||
} catch (e) {
|
||||
@@ -121,7 +121,7 @@ describe("/admin/store", () => {
|
||||
currencies: ["usd"],
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token " },
|
||||
headers: { "x-medusa-access-token": "test_token " },
|
||||
}
|
||||
)
|
||||
} catch (e) {
|
||||
@@ -144,7 +144,7 @@ describe("/admin/store", () => {
|
||||
default_currency_code: "dkk",
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token " },
|
||||
headers: { "x-medusa-access-token": "test_token " },
|
||||
}
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
@@ -180,7 +180,7 @@ describe("/admin/store", () => {
|
||||
currencies: ["jpy", "usd"],
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token " },
|
||||
headers: { "x-medusa-access-token": "test_token " },
|
||||
}
|
||||
)
|
||||
|
||||
@@ -214,7 +214,7 @@ describe("/admin/store", () => {
|
||||
currencies: ["jpy", "usd"],
|
||||
},
|
||||
{
|
||||
headers: { Authorization: "Bearer test_token " },
|
||||
headers: { "x-medusa-access-token": "test_token " },
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ jest.setTimeout(30000)
|
||||
|
||||
const adminReqConfig = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ describe("/admin/users", () => {
|
||||
const usersBeforeDelete = usersBeforeDeleteResponse.data.users
|
||||
|
||||
const response = await api.delete(`/admin/users/${userId}`, {
|
||||
headers: { Authorization: "Bearer test_token" },
|
||||
headers: { "x-medusa-access-token": "test_token" },
|
||||
})
|
||||
|
||||
const usersAfterDeleteResponse = await api.get(
|
||||
|
||||
@@ -11,7 +11,7 @@ const productSeeder = require("../../../helpers/product-seeder")
|
||||
|
||||
const adminHeaders = {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
"x-medusa-access-token": "test_token",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user