Skip to content

Commit

Permalink
Add a unit test for the case
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyad-elabid-nw committed Oct 8, 2023
1 parent 5692a1c commit b1b2a4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
### Fixes

- Change log output to show what paths are considered when collecting modules ([#3316](https://github.com/getsentry/sentry-react-native/pull/3316))
- Should not take screenshot when SDK is disabled ([#3328](https://github.com/getsentry/sentry-react-native/pull/3328))

### Dependencies

Expand Down
13 changes: 13 additions & 0 deletions test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ describe('Tests the SDK functionality', () => {
it('adds screenshot integration', () => {
init({
attachScreenshot: true,
enabled: true,
});

const actualOptions = mockedInitAndBind.mock.calls[0][secondArg] as ReactNativeClientOptions;
Expand All @@ -448,6 +449,18 @@ describe('Tests the SDK functionality', () => {
expect(actualIntegrations).toEqual(expect.arrayContaining([expect.objectContaining({ name: 'Screenshot' })]));
});

it('Should not add screenshot integration when the SDK is disabled', () => {
init({
attachScreenshot: true,
enabled: false,
});

const actualOptions = mockedInitAndBind.mock.calls[0][secondArg] as ReactNativeClientOptions;
const actualIntegrations = actualOptions.integrations;

expect(actualIntegrations).not.toEqual(expect.arrayContaining([expect.objectContaining({ name: 'Screenshot' })]));
});

it('no view hierarchy integration by default', () => {
init({});

Expand Down

0 comments on commit b1b2a4c

Please sign in to comment.