-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use sendFeedback from JS to get error messages
- Loading branch information
Showing
4 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { captureFeedback } from '@sentry/core'; | ||
import { sendFeedback } from '@sentry-internal/feedback'; | ||
import { fireEvent, render, waitFor } from '@testing-library/react-native'; | ||
import * as React from 'react'; | ||
import { Alert } from 'react-native'; | ||
|
@@ -16,7 +16,6 @@ jest.spyOn(Alert, 'alert'); | |
|
||
jest.mock('@sentry/core', () => ({ | ||
...jest.requireActual('@sentry/core'), | ||
captureFeedback: jest.fn(), | ||
getCurrentScope: jest.fn(() => ({ | ||
getUser: jest.fn(() => ({ | ||
email: '[email protected]', | ||
|
@@ -29,6 +28,9 @@ jest.mock('../../src/js/feedback/utils', () => ({ | |
...jest.requireActual('../../src/js/feedback/utils'), | ||
checkInternetConnection: jest.fn(), | ||
})); | ||
jest.mock('@sentry-internal/feedback', () => ({ | ||
sendFeedback: jest.fn(), | ||
})); | ||
|
||
const defaultProps: FeedbackFormProps = { | ||
onFormClose: mockOnFormClose, | ||
|
@@ -112,7 +114,7 @@ describe('FeedbackForm', () => { | |
}); | ||
}); | ||
|
||
it('calls captureFeedback when the form is submitted successfully', async () => { | ||
it('calls sendFeedback when the form is submitted successfully', async () => { | ||
const { getByPlaceholderText, getByText } = render(<FeedbackForm {...defaultProps} />); | ||
|
||
fireEvent.changeText(getByPlaceholderText(defaultProps.namePlaceholder), 'John Doe'); | ||
|
@@ -122,11 +124,11 @@ describe('FeedbackForm', () => { | |
fireEvent.press(getByText(defaultProps.submitButtonLabel)); | ||
|
||
await waitFor(() => { | ||
expect(captureFeedback).toHaveBeenCalledWith({ | ||
expect(sendFeedback).toHaveBeenCalledWith({ | ||
message: 'This is a feedback message.', | ||
name: 'John Doe', | ||
email: '[email protected]', | ||
}); | ||
}, undefined); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters