"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @jest-environment jsdom
 */
const react_1 = require("@testing-library/react");
const useModularDrawerVisibility_1 = require("../useModularDrawerVisibility");
const enums_1 = require("../enums");
const mock_1 = require("../../featureFlags/mock");
describe("useModularDrawerVisibility", () => {
    describe("lldModularDrawer", () => {
        it("should return false if the feature flag is not enabled", () => {
            const mockedFeatures = {
                lldModularDrawer: {
                    enabled: false,
                    params: { [enums_1.ModularDrawerLocation.ADD_ACCOUNT]: true },
                },
            };
            const { result } = (0, react_1.renderHook)(() => (0, useModularDrawerVisibility_1.useModularDrawerVisibility)({
                modularDrawerFeatureFlagKey: "lldModularDrawer",
            }), {
                wrapper: (0, mock_1.makeMockedFeatureFlagsProviderWrapper)((0, mock_1.makeMockedContextValue)(mockedFeatures)),
            });
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
        });
        it("should return false if the location param is not set", () => {
            const mockedFeatures = {
                lldModularDrawer: { enabled: true, params: {} },
            };
            const { result } = (0, react_1.renderHook)(() => (0, useModularDrawerVisibility_1.useModularDrawerVisibility)({
                modularDrawerFeatureFlagKey: "lldModularDrawer",
            }), {
                wrapper: (0, mock_1.makeMockedFeatureFlagsProviderWrapper)((0, mock_1.makeMockedContextValue)(mockedFeatures)),
            });
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
        });
        it("should return the correct visibility for each location", () => {
            const mockedFeatures = {
                lldModularDrawer: {
                    enabled: true,
                    params: {
                        [enums_1.ModularDrawerLocation.ADD_ACCOUNT]: true,
                        [enums_1.ModularDrawerLocation.EARN_FLOW]: false,
                    },
                },
            };
            const { result } = (0, react_1.renderHook)(() => (0, useModularDrawerVisibility_1.useModularDrawerVisibility)({
                modularDrawerFeatureFlagKey: "lldModularDrawer",
            }), {
                wrapper: (0, mock_1.makeMockedFeatureFlagsProviderWrapper)((0, mock_1.makeMockedContextValue)(mockedFeatures)),
            });
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.ADD_ACCOUNT)).toBe(true);
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.EARN_FLOW)).toBe(false);
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.LIVE_APP)).toBe(false);
        });
    });
    describe("llmModularDrawer", () => {
        it("should return false if the feature flag is not enabled", () => {
            const mockedFeatures = {
                llmModularDrawer: {
                    enabled: false,
                    params: { [enums_1.ModularDrawerLocation.ADD_ACCOUNT]: true },
                },
            };
            const { result } = (0, react_1.renderHook)(() => (0, useModularDrawerVisibility_1.useModularDrawerVisibility)({
                modularDrawerFeatureFlagKey: "llmModularDrawer",
            }), {
                wrapper: (0, mock_1.makeMockedFeatureFlagsProviderWrapper)((0, mock_1.makeMockedContextValue)(mockedFeatures)),
            });
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
        });
        it("should return false if the location param is not set", () => {
            const mockedFeatures = {
                llmModularDrawer: { enabled: true, params: {} },
            };
            const { result } = (0, react_1.renderHook)(() => (0, useModularDrawerVisibility_1.useModularDrawerVisibility)({
                modularDrawerFeatureFlagKey: "llmModularDrawer",
            }), {
                wrapper: (0, mock_1.makeMockedFeatureFlagsProviderWrapper)((0, mock_1.makeMockedContextValue)(mockedFeatures)),
            });
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
        });
        it("should return the correct visibility for each location", () => {
            const mockedFeatures = {
                llmModularDrawer: {
                    enabled: true,
                    params: {
                        [enums_1.ModularDrawerLocation.ADD_ACCOUNT]: false,
                        [enums_1.ModularDrawerLocation.EARN_FLOW]: true,
                        [enums_1.ModularDrawerLocation.RECEIVE_FLOW]: true,
                    },
                },
            };
            const { result } = (0, react_1.renderHook)(() => (0, useModularDrawerVisibility_1.useModularDrawerVisibility)({
                modularDrawerFeatureFlagKey: "llmModularDrawer",
            }), {
                wrapper: (0, mock_1.makeMockedFeatureFlagsProviderWrapper)((0, mock_1.makeMockedContextValue)(mockedFeatures)),
            });
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.EARN_FLOW)).toBe(true);
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.RECEIVE_FLOW)).toBe(true);
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.LIVE_APP)).toBe(false);
            expect(result.current.isModularDrawerVisible(enums_1.ModularDrawerLocation.SEND_FLOW)).toBe(false);
        });
    });
});
//# sourceMappingURL=useModularDrawerVisibility.test.js.map