feat: view config feature flag (#13171)
* feat: add view_configurations feature flag - Add feature flag provider and hooks to admin dashboard - Add backend API endpoint for feature flags - Create view_configurations feature flag (disabled by default) - Update order list table to use legacy version when flag is disabled - Can be enabled with MEDUSA_FF_VIEW_CONFIGURATIONS=true env var * fix: naming * fix: feature flags unauthenticated * fix: add test
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import {
|
||||
adminHeaders,
|
||||
createAdminUser,
|
||||
} from "../../../../helpers/create-admin-user"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
medusaIntegrationTestRunner({
|
||||
testSuite: ({ dbConnection, getContainer, api }) => {
|
||||
describe("GET /admin/feature-flags", () => {
|
||||
it("should return feature flags when unauthenticated", async () => {
|
||||
const response = await api.get("/admin/feature-flags")
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data).toHaveProperty("feature_flags")
|
||||
expect(response.data.feature_flags).toEqual(
|
||||
expect.objectContaining({
|
||||
view_configurations: false,
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should return feature flags when authenticated as admin", async () => {
|
||||
const container = getContainer()
|
||||
await createAdminUser(dbConnection, adminHeaders, container)
|
||||
|
||||
const response = await api.get("/admin/feature-flags", adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data).toHaveProperty("feature_flags")
|
||||
expect(response.data.feature_flags).toEqual(
|
||||
expect.objectContaining({
|
||||
view_configurations: false,
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user