chore: Create publishable API key as part of the defaults (#14356)
* wip * chore: fix tests * Create tiny-carrots-bathe.md
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ApiKeyType } from "@medusajs/utils"
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import { ApiKeyType } from "@medusajs/utils"
|
||||
import {
|
||||
adminHeaders,
|
||||
createAdminUser,
|
||||
@@ -74,7 +74,7 @@ medusaIntegrationTestRunner({
|
||||
const listedApiKeys = await api.get(`/admin/api-keys`, adminHeaders)
|
||||
|
||||
expect(deleted.status).toEqual(200)
|
||||
expect(listedApiKeys.data.api_keys).toHaveLength(0)
|
||||
expect(listedApiKeys.data.api_keys).toHaveLength(1) // we still have the default publishable api key
|
||||
})
|
||||
|
||||
it("should allow searching for api keys", async () => {
|
||||
@@ -108,9 +108,16 @@ medusaIntegrationTestRunner({
|
||||
expect(listedSecretKeys.data.api_keys[0].title).toEqual(
|
||||
"Test Secret Key"
|
||||
)
|
||||
expect(listedPublishableKeys.data.api_keys).toHaveLength(1)
|
||||
expect(listedPublishableKeys.data.api_keys[0].title).toEqual(
|
||||
"Test Publishable Key"
|
||||
expect(listedPublishableKeys.data.api_keys).toHaveLength(2)
|
||||
expect(listedPublishableKeys.data.api_keys).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
title: "Test Publishable Key",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
title: "Default Publishable API Key",
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
expect(response.data.count).toBe(2)
|
||||
expect(response.data.count).toBe(3) // two created keys and the default publishable api key
|
||||
expect(response.data.limit).toBe(2)
|
||||
expect(response.data.offset).toBe(0)
|
||||
expect(response.data.api_keys).toHaveLength(2)
|
||||
|
||||
Reference in New Issue
Block a user