Skip to content

Commit

Permalink
Fix test import
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis committed Jan 29, 2025
1 parent 8071e8d commit d8ab914
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/test/feedback/FeedbackFormManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import * as React from 'react';
import { Text } from 'react-native';

import { FeedbackFormProvider, showFeedbackForm } from '../../src/js/feedback/FeedbackFormManager';
import { isModalSupported } from '../../src/js/feedback/utils';

jest.mock('../../src/js/feedback/utils', () => ({
isModalSupported: jest.fn(),
}));

const mockedIsModalSupported = isModalSupported as jest.MockedFunction<typeof isModalSupported>;

beforeEach(() => {
logger.error = jest.fn();
});

describe('FeedbackFormManager', () => {
it('showFeedbackForm displays the form when FeedbackFormProvider is used', () => {
require('../../src/js/feedback/utils').isModalSupported.mockReturnValue(true);
mockedIsModalSupported.mockReturnValue(true);
const { getByText, getByTestId } = render(
<FeedbackFormProvider>
<Text>App Components</Text>
Expand All @@ -29,7 +32,7 @@ describe('FeedbackFormManager', () => {
});

it('showFeedbackForm does not display the form when Modal is not available', () => {
require('../../src/js/feedback/utils').isModalSupported.mockReturnValue(false);
mockedIsModalSupported.mockReturnValue(false);
const { getByText, queryByTestId } = render(
<FeedbackFormProvider>
<Text>App Components</Text>
Expand Down

0 comments on commit d8ab914

Please sign in to comment.