-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add promise when calling func requestAppReview (#27)
Add Promise While requesting InAppReview flow for analytic purpose..
- Loading branch information
1 parent
18a138f
commit a5a13db
Showing
11 changed files
with
15,792 additions
and
149 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,56 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
import {Platform} from 'react-native'; | ||
import InAppReview from '../'; | ||
|
||
jest.mock('react-native/Libraries/BatchedBridge/NativeModules', () => { | ||
let _NativeModules = {}; | ||
|
||
return _NativeModules; | ||
}); | ||
|
||
jest.mock('react-native/Libraries/Utilities/Platform', () => { | ||
let platform = { | ||
OS: 'ios', | ||
}; | ||
|
||
const select = jest.fn().mockImplementation((obj) => { | ||
const value = obj[platform.OS]; | ||
return !value ? obj.default : value; | ||
}); | ||
|
||
platform.select = select; | ||
|
||
return platform; | ||
}); | ||
|
||
describe('test-react-native-in-app-review-without-NativeModules-exist', () => { | ||
it('should throw error in iOS Module if module not exist', async () => { | ||
Platform.OS = 'ios'; | ||
|
||
const errorMessageExpected = | ||
'InAppReview native module not available, did you forget to link the library?'; | ||
|
||
expect(() => { | ||
InAppReview.RequestInAppReview(); | ||
}).toThrow(errorMessageExpected); | ||
}); | ||
|
||
it('should throw error in android Module if module not exist', async () => { | ||
Platform.OS = 'android'; | ||
|
||
const errorMessageExpected = | ||
'InAppReview native module not available, did you forget to link the library?'; | ||
|
||
expect(() => { | ||
InAppReview.RequestInAppReview(); | ||
}).toThrow(errorMessageExpected); | ||
}); | ||
}); |
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.