Files
medusa-store/integration-tests/http/__tests__/feature-flags/admin/feature-flags.spec.ts
Sebastian Rindom ab795bb0a2 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
2025-08-15 08:56:40 +02:00

41 lines
1.3 KiB
TypeScript

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,
})
)
})
})
},
})