1 import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
2 import {
3 adminHeaders,
4 createAdminUser,
5 } from "../../../../helpers/create-admin-user"
6
7 jest.setTimeout(30000)
8
9 medusaIntegrationTestRunner({
10 testSuite: ({ dbConnection, getContainer, api }) => {
11 describe("GET /admin/feature-flags", () => {
12 it("should return feature flags when unauthenticated", async () => {
13 const response = await api.get("/admin/feature-flags")
14
15 expect(response.status).toEqual(200)
16 expect(response.data).toHaveProperty("feature_flags")
17 expect(response.data.feature_flags).toEqual(
18 expect.objectContaining({
19 view_configurations: false,
20 })
21 )
22 })
23
24 it("should return feature flags when authenticated as admin", async () => {
25 const container = getContainer()
26 await createAdminUser(dbConnection, adminHeaders, container)
27
28 const response = await api.get("/admin/feature-flags", adminHeaders)
29
30 expect(response.status).toEqual(200)
31 expect(response.data).toHaveProperty("feature_flags")
32 expect(response.data.feature_flags).toEqual(
33 expect.objectContaining({
34 view_configurations: false,
35 })
36 )
37 })
38 })
39 },
40 })