Skip to content

Commit

Permalink
Merge branch 'antonis/feedback-autoinject' into antonis/feedback-inte…
Browse files Browse the repository at this point in the history
…gration

# Conflicts:
#	packages/core/test/feedback/FeedbackFormManager.test.tsx
  • Loading branch information
antonis committed Jan 29, 2025
2 parents 016f77a + d8ab914 commit b394960
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/test/feedback/FeedbackFormManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ import { Text } from 'react-native';

import { FeedbackFormProvider, showFeedbackForm } from '../../src/js/feedback/FeedbackFormManager';
import { feedbackIntegration } from '../../src/js/feedback/integration';
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 @@ -30,7 +33,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 All @@ -53,7 +56,7 @@ describe('FeedbackFormManager', () => {
});

it('showFeedbackForm displays the form with the feedbackIntegration options', () => {
require('../../src/js/feedback/utils').isModalSupported.mockReturnValue(true);
mockedIsModalSupported.mockReturnValue(true);
const { getByPlaceholderText, getByText } = render(
<FeedbackFormProvider>
<Text>App Components</Text>
Expand Down

0 comments on commit b394960

Please sign in to comment.