-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be04dfc
commit 77691bd
Showing
2 changed files
with
68 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { describe, expect, it, beforeEach } from '@jest/globals'; | ||
|
||
describe('CustomMask', () => { | ||
beforeEach(() => { | ||
jest.resetModules(); | ||
}); | ||
|
||
it('returns a fallback when native view manager is missing', () => { | ||
jest.mock('react-native', () => ({ | ||
UIManager: {}, | ||
View: jest.fn(), | ||
})); | ||
|
||
const { Mask, Unmask } = require('../../src/js/replay/CustomMask'); | ||
|
||
expect(Mask).toBeDefined(); | ||
expect(Unmask).toBeDefined(); | ||
}); | ||
|
||
it('returns a fallback component when native view manager config is missing', () => { | ||
jest.mock('react-native', () => ({ | ||
UIManager: { | ||
hasViewManagerConfig: () => false, | ||
}, | ||
View: jest.fn(), | ||
})); | ||
|
||
const { Mask, Unmask } = require('../../src/js/replay/CustomMask'); | ||
|
||
expect(Mask).toBeDefined(); | ||
expect(Unmask).toBeDefined(); | ||
}); | ||
|
||
it('returns native components when native components exist', () => { | ||
const mockMaskComponent = jest.fn(); | ||
const mockUnmaskComponent = jest.fn(); | ||
|
||
jest.mock('../../src/js/RNSentryReplayMaskNativeComponent', () => ({ | ||
default: mockMaskComponent, | ||
})); | ||
|
||
jest.mock('../../src/js/RNSentryReplayUnmaskNativeComponent', () => ({ | ||
default: mockUnmaskComponent, | ||
})); | ||
|
||
jest.mock('react-native', () => ({ | ||
UIManager: { | ||
hasViewManagerConfig: () => true, | ||
}, | ||
View: jest.fn(), | ||
})); | ||
|
||
const { Mask, Unmask } = require('../../src/js/replay/CustomMask'); | ||
|
||
expect(Mask).toBe(mockMaskComponent); | ||
expect(Unmask).toBe(mockUnmaskComponent); | ||
}); | ||
}); |
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,10 @@ | ||
import { describe } from '@jest/globals'; | ||
|
||
describe('CustomMask', () => { | ||
it('returns a react native view', () => { | ||
const { Mask, Unmask } = require('../../src/js/replay/CustomMask'); | ||
|
||
expect(Mask).toBeDefined(); | ||
expect(Unmask).toBeDefined(); | ||
}); | ||
}); |