mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
ADD: Mock RNWatch test
This commit is contained in:
parent
32592c272a
commit
0eb5e1952a
3 changed files with 15 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
import * as watch from 'react-native-watch-connectivity';
|
||||
import * as Watch from 'react-native-watch-connectivity';
|
||||
import { InteractionManager, Platform } from 'react-native';
|
||||
const loc = require('./loc');
|
||||
export default class WatchConnectivity {
|
||||
|
@ -13,13 +13,13 @@ export default class WatchConnectivity {
|
|||
|
||||
getIsWatchAppInstalled() {
|
||||
if (Platform.OS !== 'ios') return;
|
||||
watch.getIsWatchAppInstalled((err, isAppInstalled) => {
|
||||
Watch.getIsWatchAppInstalled((err, isAppInstalled) => {
|
||||
if (!err) {
|
||||
this.isAppInstalled = isAppInstalled;
|
||||
this.sendWalletsToWatch();
|
||||
}
|
||||
});
|
||||
watch.subscribeToMessages(async (err, message, reply) => {
|
||||
Watch.subscribeToMessages(async (err, message, reply) => {
|
||||
if (!err) {
|
||||
if (message.request === 'createInvoice') {
|
||||
const createInvoiceRequest = await this.handleLightningInvoiceCreateRequest(
|
||||
|
@ -131,7 +131,7 @@ export default class WatchConnectivity {
|
|||
});
|
||||
}
|
||||
|
||||
watch.updateApplicationContext({ wallets });
|
||||
Watch.updateApplicationContext({ wallets });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
"preset": "react-native",
|
||||
"transform": {
|
||||
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
|
||||
}
|
||||
},
|
||||
"setupFiles": [
|
||||
"./tests/setup.js"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/preset-env": "7.5.0",
|
||||
|
|
7
tests/setup.js
Normal file
7
tests/setup.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
jest.mock('react-native-watch-connectivity', () => {
|
||||
return {
|
||||
getIsWatchAppInstalled: jest.fn(),
|
||||
subscribeToMessages: jest.fn(),
|
||||
updateApplicationContext: jest.fn(),
|
||||
}
|
||||
})
|
Loading…
Add table
Reference in a new issue