This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
forked from segmentio/analytics-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bridge): improve missing native module error (segmentio#5)
- Loading branch information
Showing
7 changed files
with
2,593 additions
and
300 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const forceRequire = (): typeof import('../bridge') => { | ||
jest.resetModules() | ||
|
||
return require.requireActual('../bridge') | ||
} | ||
|
||
it('should throw an error if the core native module is not linked', () => { | ||
jest.setMock('react-native', { | ||
NativeModules: {} | ||
}) | ||
|
||
expect(forceRequire).toThrow(/Failed to load Analytics native module./) | ||
}) | ||
|
||
it('should export the core native module', () => { | ||
const RNAnalytics = {} | ||
|
||
jest.setMock('react-native', { | ||
NativeModules: { RNAnalytics } | ||
}) | ||
|
||
expect(forceRequire().default).toBe(RNAnalytics) | ||
}) |
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
Oops, something went wrong.