-
-
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.
Merge branch 'antonis/4359-Feedback-Form-NetworkError' into antonis/4…
…359-Feedback-Form-SendFeedback # Conflicts: # packages/core/src/js/feedback/FeedbackForm.tsx
- Loading branch information
Showing
7 changed files
with
54 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,19 +22,11 @@ | |
email: "[email protected]", | ||
message: "Hello World!", | ||
associatedEventId: eventId, // optional | ||
}, { | ||
captureContext: { | ||
tags: { "tag-key": "tag-value" }, | ||
}, | ||
attachments: [ | ||
{ | ||
filename: 'hello.txt', | ||
data: 'Hello, World!', | ||
}, | ||
], | ||
}); | ||
``` | ||
|
||
To learn how to attach context data to the feedback visit [the documentation](https://docs.sentry.io/platforms/react-native/user-feedback/). | ||
|
||
- User Feedback Form Component Beta ([#4320](https://github.com/getsentry/sentry-react-native/pull/4328)) | ||
|
||
To collect user feedback from inside your application add the `FeedbackForm` component. | ||
|
@@ -46,6 +38,7 @@ | |
``` | ||
|
||
- Export `Span` type from `@sentry/types` ([#4345](https://github.com/getsentry/sentry-react-native/pull/4345)) | ||
- Add RN SDK package to `sdk.packages` on Android ([#4380](https://github.com/getsentry/sentry-react-native/pull/4380)) | ||
|
||
### Fixes | ||
|
||
|
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
8 changes: 8 additions & 0 deletions
8
packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.sentry.react; | ||
|
||
class RNSentryVersion { | ||
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native"; | ||
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.4.0"; | ||
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native"; | ||
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native"; | ||
} |
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 |
---|---|---|
|
@@ -11,16 +11,17 @@ const mockOnFormClose = jest.fn(); | |
const mockOnSubmitSuccess = jest.fn(); | ||
const mockOnFormSubmitted = jest.fn(); | ||
const mockOnSubmitError = jest.fn(); | ||
const mockGetUser = jest.fn(() => ({ | ||
email: '[email protected]', | ||
name: 'Test User', | ||
})); | ||
|
||
jest.spyOn(Alert, 'alert'); | ||
|
||
jest.mock('@sentry/core', () => ({ | ||
...jest.requireActual('@sentry/core'), | ||
getCurrentScope: jest.fn(() => ({ | ||
getUser: jest.fn(() => ({ | ||
email: '[email protected]', | ||
name: 'Test User', | ||
})), | ||
getUser: mockGetUser, | ||
})), | ||
lastEventId: jest.fn(), | ||
})); | ||
|
@@ -89,6 +90,17 @@ describe('FeedbackForm', () => { | |
expect(emailInput.props.value).toBe('[email protected]'); | ||
}); | ||
|
||
it('ensure getUser is called only after the component is rendered', () => { | ||
// Ensure getUser is not called before render | ||
expect(mockGetUser).not.toHaveBeenCalled(); | ||
|
||
// Render the component | ||
render(<FeedbackForm />); | ||
|
||
// After rendering, check that getUser was called twice (email and name) | ||
expect(mockGetUser).toHaveBeenCalledTimes(2); | ||
}); | ||
|
||
it('shows an error message if required fields are empty', async () => { | ||
const { getByText } = render(<FeedbackForm {...defaultProps} />); | ||
|
||
|
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