Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adjust tests after transition to new rn #126

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"rules": {
"react/jsx-handler-names": "off", // activated by standard-react config
"react/display-name": "off",
"react-native/no-inline-styles": "error",
"react-native/no-unused-styles": "error",
"react-native/no-inline-styles": "warn",
"react-native/no-unused-styles": "warn",
"react/no-is-mounted": "off",
"react-native/no-single-element-style-arrays": "error",
"prettier/prettier": [
Expand Down Expand Up @@ -50,7 +50,10 @@
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-use-before-define": "off"
"@typescript-eslint/no-use-before-define": "off",

"@typescript-eslint/no-unused-vars": "off",
"no-unreachable": "warn"
},
"overrides": [
{
Expand All @@ -67,8 +70,7 @@
}
],
"env": {
"es6": true,
"jest": true
"es6": true
},
"globals": { "fetch": false },
"settings": {
Expand Down
2 changes: 0 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ module.exports = {
singleQuote: true,
printWidth: 500,
tabWidth: 2,
arrowParens: 'avoid',
bracketSameLine: true,
};
2 changes: 1 addition & 1 deletion App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'react-native-gesture-handler'; // should be on top
import React, { useContext, useEffect, useRef } from 'react';
import {

Check warning on line 3 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `⏎··AppState,⏎··Text,⏎··DeviceEventEmitter,⏎··NativeModules,⏎··NativeEventEmitter,⏎··Linking,⏎··Platform,⏎··StyleSheet,⏎··UIManager,⏎··useColorScheme,⏎··View,⏎··StatusBar,⏎··Alert⏎` with `·AppState,·Text,·DeviceEventEmitter,·NativeModules,·NativeEventEmitter,·Linking,·Platform,·StyleSheet,·UIManager,·useColorScheme,·View,·StatusBar,·Alert·`
AppState,
Text,
DeviceEventEmitter,
Expand Down Expand Up @@ -137,7 +137,7 @@
notificationSubscription.remove();
settingsSubscription.remove();
userActivitySubscription.remove();
}

Check warning on line 140 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Insert `;`
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [walletsInitialized]);

Expand All @@ -147,7 +147,7 @@
eventEmitter.removeAllListeners('openSettings');
eventEmitter.removeAllListeners('onUserActivityOpen');
};
// eslint-disable-next-line react-hooks/exhaustive-deps

Check warning on line 150 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'react-hooks/exhaustive-deps' rule is disabled but never reported
}, []);

useEffect(() => {
Expand All @@ -164,7 +164,7 @@

const popInitialAction = async (data) => {
if (data) {
const wallet = wallets.find((wallet) => wallet.getID() === data.userInfo.url.split('wallet/')[1]);

Check warning on line 167 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'wallet' is already declared in the upper scope on line 167 column 13
NavigationService.dispatch(
CommonActions.navigate({
name: 'WalletTransactions',
Expand All @@ -185,7 +185,7 @@
const isViewAllWalletsEnabled = await OnAppLaunch.isViewAllWalletsEnabled();
if (!isViewAllWalletsEnabled) {
const selectedDefaultWallet = await OnAppLaunch.getSelectedDefaultWallet();
const wallet = wallets.find((wallet) => wallet.getID() === selectedDefaultWallet.getID());

Check warning on line 188 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'wallet' is already declared in the upper scope on line 188 column 17
if (wallet) {
NavigationService.dispatch(
CommonActions.navigate({
Expand All @@ -204,7 +204,7 @@
};

const walletQuickActions = (data) => {
const wallet = wallets.find((wallet) => wallet.getID() === data.userInfo.url.split('wallet/')[1]);

Check warning on line 207 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'wallet' is already declared in the upper scope on line 207 column 11
NavigationService.dispatch(
CommonActions.navigate({
name: 'WalletTransactions',
Expand Down Expand Up @@ -387,7 +387,7 @@
{/* <NavigationContainer ref={navigationRef} theme={colorScheme === 'dark' ? BlueDarkTheme : BlueDefaultTheme}> */}
<NavigationContainer ref={navigationRef} theme={BlueDefaultTheme}>
<InitRoot />
{/* <Notifications onProcessNotifications={processPushNotifications} />*/}
{/* <Notifications onProcessNotifications={processPushNotifications} /> */}

Check warning on line 390 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Insert `··`
</NavigationContainer>
{walletsInitialized && !isDesktop && <WatchConnectivity />}
</View>
Expand All @@ -402,10 +402,10 @@
root: {
flex: 1,
},
space: {

Check warning on line 405 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Unused style detected: styles.space
marginHorizontal: 8,
},
modalContent: {

Check warning on line 408 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Unused style detected: styles.modalContent
padding: 22,
justifyContent: 'center',
alignItems: 'center',
Expand All @@ -415,7 +415,7 @@
minHeight: 200,
height: 200,
},
modelContentButtonLayout: {

Check warning on line 418 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Unused style detected: styles.modelContentButtonLayout
flexDirection: 'row',
margin: 16,
justifyContent: 'space-between',
Expand Down
2 changes: 1 addition & 1 deletion blue_modules/BlueElectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async function presentNetworkErrorAlert(usingPeer) {
await DefaultPreference.clear(ELECTRUM_HOST);
await DefaultPreference.clear(ELECTRUM_SSL_PORT);
await DefaultPreference.clear(ELECTRUM_TCP_PORT);
WidgetCommunication.reloadAllTimelines();
// WidgetCommunication.reloadAllTimelines();
} catch (e) {
// Must be running on Android
console.log(e);
Expand Down
2 changes: 1 addition & 1 deletion blue_modules/Privacy.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Privacy = () => {
}, [isPrivacyBlurEnabled]);

Privacy.enableBlur = () => {
if (!isPrivacyBlurEnabled) return;
// if (!isPrivacyBlurEnabled) return;
// Obscure.activateObscure();
};

Expand Down
2 changes: 1 addition & 1 deletion blue_modules/Privacy.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Privacy = () => {
}, [isPrivacyBlurEnabled]);

Privacy.enableBlur = () => {
if (!isPrivacyBlurEnabled) return;
// if (!isPrivacyBlurEnabled) return;
// enabled(true);
};

Expand Down
42 changes: 21 additions & 21 deletions blue_modules/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ const showImagePickerAndReadImage = () => {
const asset = response.assets[0];
if (asset.uri) {
const uri = asset.uri.toString().replace('file://', '');
LocalQRCode.decode(uri, (error, result) => {
if (!error) {
resolve(result);
} else {
reject(new Error(loc.send.qr_error_no_qrcode));
}
});
// LocalQRCode.decode(uri, (error, result) => {
// if (!error) {
// resolve(result);
// } else {
// reject(new Error(loc.send.qr_error_no_qrcode));
// }
// });
}
}
},
Expand All @@ -145,13 +145,13 @@ const takePhotoWithImagePickerAndReadPhoto = () => {
(response) => {
if (response.uri) {
const uri = response.uri.toString().replace('file://', '');
LocalQRCode.decode(uri, (error, result) => {
if (!error) {
resolve(result);
} else {
reject(new Error(loc.send.qr_error_no_qrcode));
}
});
// LocalQRCode.decode(uri, (error, result) => {
// if (!error) {
// resolve(result);
// } else {
// reject(new Error(loc.send.qr_error_no_qrcode));
// }
// });
} else if (response.error) {
presentCameraNotAuthorizedAlert(response.error);
}
Expand Down Expand Up @@ -179,13 +179,13 @@ const showFilePickerAndReadFile = async function () {
if (res?.type === DocumentPicker.types.images || res?.type?.startsWith('image/')) {
return new Promise((resolve) => {
const uri = res.uri.toString().replace('file://', '');
LocalQRCode.decode(decodeURI(uri), (error, result) => {
if (!error) {
resolve({ data: result, uri: decodeURI(res.uri) });
} else {
resolve({ data: false, uri: false });
}
});
// LocalQRCode.decode(decodeURI(uri), (error, result) => {
// if (!error) {
// resolve({ data: result, uri: decodeURI(res.uri) });
// } else {
// resolve({ data: false, uri: false });
// }
// });
});
}

Expand Down
4 changes: 2 additions & 2 deletions class/aopp.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class AOPP {

constructor(uri) {
this.uri = uri;
const { protocol, query } = url.parse(uri, true); // eslint-disable-line node/no-deprecated-api
const { protocol, query } = url.parse(uri, true); // eslint-disable-line

if (protocol !== 'aopp:') throw new Error('Unsupported protocol');
if (query.v !== '0') throw new Error('Unsupported version');
Expand All @@ -45,7 +45,7 @@ export default class AOPP {
this.callback = query.callback;

// parse callback url
const { hostname } = url.parse(this.callback, true); // eslint-disable-line node/no-deprecated-api
const { hostname } = url.parse(this.callback, true); // eslint-disable-line
if (!hostname) throw new Error('Wrong callback');

this.callbackHostname = hostname;
Expand Down
2 changes: 1 addition & 1 deletion class/azteco.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class Azteco {
}

static getParamsFromUrl(u) {
const urlObject = url.parse(u, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(u, true); // eslint-disable-line
return {
uri: u,
c1: urlObject.query.c1,
Expand Down
8 changes: 4 additions & 4 deletions class/deeplink-schema-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DeeplinkSchemaMatch {
}
}
} else if (DeeplinkSchemaMatch.isChallengeAction(event.url)) {
const urlObject = url.parse(event.url, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(event.url, true); // eslint-disable-line
completionHandler([
'SignChallengeRoot',
{
Expand Down Expand Up @@ -171,7 +171,7 @@ class DeeplinkSchemaMatch {
},
]);
} else if (DeeplinkSchemaMatch.isSafelloRedirect(event)) {
const urlObject = url.parse(event.url, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(event.url, true); // eslint-disable-line

const safelloStateToken = urlObject.query['safello-state-token'];
let wallet;
Expand Down Expand Up @@ -209,7 +209,7 @@ class DeeplinkSchemaMatch {
},
]);
} else {
const urlObject = url.parse(event.url, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(event.url, true); // eslint-disable-line
(async () => {
if (urlObject.protocol === 'aopp:') {
completionHandler([
Expand Down Expand Up @@ -400,7 +400,7 @@ class DeeplinkSchemaMatch {
}

static isSafelloRedirect(event) {
const urlObject = url.parse(event.url, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(event.url, true); // eslint-disable-line

return !!urlObject.query['safello-state-token'];
}
Expand Down
12 changes: 6 additions & 6 deletions components/BtcMltComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ export const BtcMlcComponent = forwardRef((props, ref) => {
return (
<TouchableOpacity style={[{ backgroundColor: colors.aquaHaze }, styles.TouchableTags]}>
<View style={styles.container}>
<View style={[styles.doubleEle]}>
<View style={[styles.arrowContainer]}>
<View style={styles.doubleEle}>
<View style={styles.arrowContainer}>
<Image source={props.source} />
</View>
<View>
{props.title && <Text style={[styles.titleText, { color: colors.walletBalanceBgColor }]}>{props.title}</Text>}
{props.title && <Text style={[styles.detailText, { color: colors.walletBalanceBgColor }]}>{props.detail}</Text>}
</View>
</View>
<View style={[styles.secondDoubleEle]}>
<View style={styles.secondDoubleEle}>
{props.amount > 383.0 ? (
<ComingSoon text={loc.addresses.comming_soon} />
) : (
<View style={[styles.secondDoubleEle]}>
<View style={styles.secondDoubleEle}>
<Text style={[styles.amountText, { color: colors.walletBalanceBgColor }]}>{props.amount}</Text>

<View style={[styles.doubleEle]}>
<View style={styles.doubleEle}>
<Text style={[styles.dateText, { color: colors.walletBalanceBgColor }]}>{props.date}</Text>
<Text style={[styles.dateText]}>{props.title}</Text>
<Text style={styles.dateText}>{props.title}</Text>
</View>
</View>
)}
Expand Down
13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
testEnvironment: '<rootDir>/tests/custom-environment.js',
reporters: ['default', ['<rootDir>/tests/custom-reporter.js', {}]],
preset: 'react-native',
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
transformIgnorePatterns: ['node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?)|@rneui|silent-payments/)'],
setupFiles: ['./tests/setup.js'],
watchPathIgnorePatterns: ['<rootDir>/node_modules'],
setupFilesAfterEnv: ['./tests/setupAfterEnv.js'],
};
Loading
Loading