Skip to content

TypeError: scope.enabled is not a function when trying to test a component #11948

Discussion options

You must be logged in to vote

Worked it out:

import { useFeatureFlag } from "@carbon/react/lib/components/FeatureFlags";
jest.mock("@carbon/react/lib/components/FeatureFlags");
const useFeatureFlagMock = mockFunction(useFeatureFlag);
useFeatureFlagMock.mockReturnValue(true);

May save some time for someone else, facing the same issue

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tay1orjones
Comment options

Answer selected by rekaburmeister
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants