mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 07:15:35 +01:00
more tests
This commit is contained in:
parent
145e298825
commit
41a1ce812b
8 changed files with 171 additions and 137 deletions
1
App.js
1
App.js
|
@ -1,4 +1,3 @@
|
||||||
/** @type {AppStorage} */
|
|
||||||
import './shim.js';
|
import './shim.js';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
24
App.test.js
24
App.test.js
|
@ -1,7 +1,12 @@
|
||||||
/* global describe, it */
|
/* global describe, it, expect, jest */
|
||||||
|
import React from 'react';
|
||||||
import { LegacyWallet } from './class';
|
import { LegacyWallet } from './class';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
import App from './App';
|
||||||
|
import Settings from './screen/settings';
|
||||||
|
import { BlueHeader } from './BlueComponents';
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
|
jest.mock('react-native-qrcode', () => 'Video');
|
||||||
|
|
||||||
describe('unit - LegacyWallet', function() {
|
describe('unit - LegacyWallet', function() {
|
||||||
it('serialize and unserialize work correctly', () => {
|
it('serialize and unserialize work correctly', () => {
|
||||||
|
@ -15,3 +20,18 @@ describe('unit - LegacyWallet', function() {
|
||||||
assert.equal(key, JSON.stringify(b));
|
assert.equal(key, JSON.stringify(b));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('App does not crash', () => {
|
||||||
|
const rendered = renderer.create(<App />).toJSON();
|
||||||
|
expect(rendered).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('BlueHeader works', () => {
|
||||||
|
const rendered = renderer.create(<BlueHeader />).toJSON();
|
||||||
|
expect(rendered).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Settings work', () => {
|
||||||
|
const rendered = renderer.create(<Settings />).toJSON();
|
||||||
|
expect(rendered).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
"ios": "react-native-scripts ios",
|
"ios": "react-native-scripts ios",
|
||||||
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack",
|
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack",
|
||||||
"test": "nodejs ./node_modules/.bin/mocha tests/* && node node_modules/jest/bin/jest.js && npm run lint",
|
"test": "nodejs ./node_modules/.bin/mocha tests/* && node node_modules/jest/bin/jest.js && npm run lint",
|
||||||
"lint": "./node_modules/.bin/eslint *.js screen/**/*.js --fix"
|
"lint": "./node_modules/.bin/eslint *.js screen/**/*.js screen/ --fix"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "jest-expo"
|
"preset": "jest-expo"
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
import React from 'react'
|
import { StackNavigator } from 'react-navigation';
|
||||||
import { StackNavigator } from 'react-navigation'
|
|
||||||
|
|
||||||
import list from './receive/list'
|
import list from './receive/list';
|
||||||
import details from './receive/details'
|
import details from './receive/details';
|
||||||
|
|
||||||
const ReceiveNavigator = StackNavigator({
|
const ReceiveNavigator = StackNavigator(
|
||||||
SendList: {
|
{
|
||||||
screen: list
|
SendList: {
|
||||||
|
screen: list,
|
||||||
|
},
|
||||||
|
ReceiveDetails: {
|
||||||
|
screen: details,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
ReceiveDetails: {
|
{
|
||||||
screen: details
|
headerMode: 'none',
|
||||||
}
|
mode: 'modal',
|
||||||
}, {
|
},
|
||||||
headerMode: 'none',
|
);
|
||||||
mode: 'modal'
|
|
||||||
})
|
|
||||||
|
|
||||||
export default ReceiveNavigator
|
export default ReceiveNavigator;
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
import React from 'react'
|
import { StackNavigator } from 'react-navigation';
|
||||||
import { StackNavigator } from 'react-navigation'
|
|
||||||
|
|
||||||
import list from './send/list'
|
import list from './send/list';
|
||||||
import details from './send/details'
|
import details from './send/details';
|
||||||
import scanQrAddress from './send/scanQrAddress'
|
import scanQrAddress from './send/scanQrAddress';
|
||||||
import create from './send/create'
|
import create from './send/create';
|
||||||
|
|
||||||
const SendNavigator = StackNavigator({
|
const SendNavigator = StackNavigator(
|
||||||
SendList: {
|
{
|
||||||
screen: list
|
SendList: {
|
||||||
|
screen: list,
|
||||||
|
},
|
||||||
|
SendDetails: {
|
||||||
|
screen: details,
|
||||||
|
},
|
||||||
|
ScanQrAddress: {
|
||||||
|
screen: scanQrAddress,
|
||||||
|
},
|
||||||
|
CreateTransaction: {
|
||||||
|
screen: create,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
SendDetails: {
|
{
|
||||||
screen: details
|
headerMode: 'none',
|
||||||
|
mode: 'modal',
|
||||||
},
|
},
|
||||||
ScanQrAddress: {
|
);
|
||||||
screen: scanQrAddress
|
|
||||||
},
|
|
||||||
CreateTransaction: {
|
|
||||||
screen: create
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
headerMode: 'none',
|
|
||||||
mode: 'modal'
|
|
||||||
})
|
|
||||||
|
|
||||||
export default SendNavigator
|
export default SendNavigator;
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
let BlueApp = require('../BlueApp')
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { ScrollView, Linking, ActivityIndicator, StyleSheet, ListView, Text, View } from 'react-native';
|
import { ScrollView, Linking } from 'react-native';
|
||||||
import Ionicons from 'react-native-vector-icons/Ionicons';
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
||||||
import { SafeAreaView, TabNavigator } from 'react-navigation';
|
import { Icon } from 'react-native-elements';
|
||||||
import { Icon, Card, Header, List, ListItem, Avatar } from 'react-native-elements'
|
|
||||||
import {
|
import {
|
||||||
BlueLoading, BlueSpacing20, BlueList, BlueButton, SafeBlueArea, BlueCard, BlueText, BlueListItem, BlueHeader,
|
BlueLoading,
|
||||||
BlueFormInput, BlueSpacing
|
BlueSpacing20,
|
||||||
} from '../BlueComponents'
|
BlueButton,
|
||||||
|
SafeBlueArea,
|
||||||
|
BlueCard,
|
||||||
|
BlueText,
|
||||||
|
BlueHeader,
|
||||||
|
} from '../BlueComponents';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
let BlueApp = require('../BlueApp');
|
||||||
|
|
||||||
export default class Settings extends Component {
|
export default class Settings extends Component {
|
||||||
|
|
||||||
static navigationOptions = {
|
static navigationOptions = {
|
||||||
tabBarLabel: 'Settings',
|
tabBarLabel: 'Settings',
|
||||||
tabBarIcon: ({ tintColor, focused }) => (
|
tabBarIcon: ({ tintColor, focused }) => (
|
||||||
|
@ -21,65 +24,67 @@ export default class Settings extends Component {
|
||||||
style={{ color: tintColor }}
|
style={{ color: tintColor }}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {navigate} = this.props.navigation;
|
|
||||||
|
|
||||||
if (this.state.isLoading) {
|
if (this.state.isLoading) {
|
||||||
return (
|
return <BlueLoading />;
|
||||||
<BlueLoading/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{flex: 1}}>
|
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
|
||||||
<BlueHeader
|
<BlueHeader
|
||||||
backgroundColor={BlueApp.settings.brandingColor}
|
backgroundColor={BlueApp.settings.brandingColor}
|
||||||
leftComponent={<Icon name='menu' color="#fff" onPress={() => this.props.navigation.navigate('DrawerToggle') }/>}
|
leftComponent={
|
||||||
centerComponent={{ text: 'Settings', style: { color: '#fff', fontSize: 25 }}}
|
<Icon
|
||||||
|
name="menu"
|
||||||
|
color="#fff"
|
||||||
|
onPress={() => this.props.navigation.navigate('DrawerToggle')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
centerComponent={{
|
||||||
|
text: 'Settings',
|
||||||
|
style: { color: '#fff', fontSize: 25 },
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<BlueCard>
|
<BlueCard>
|
||||||
|
<ScrollView maxHeight={450}>
|
||||||
<ScrollView
|
|
||||||
maxHeight={450}
|
|
||||||
>
|
|
||||||
<BlueText h1>About</BlueText>
|
<BlueText h1>About</BlueText>
|
||||||
<BlueSpacing20/>
|
<BlueSpacing20 />
|
||||||
|
|
||||||
<BlueText h4>Blue Wallet is free and opensource Bitcoin wallet</BlueText>
|
<BlueText h4>
|
||||||
<BlueText>Warning: Alpha version, don't use to store large amouts!</BlueText>
|
Blue Wallet is free and opensource Bitcoin wallet
|
||||||
|
</BlueText>
|
||||||
|
<BlueText>
|
||||||
|
Warning: Alpha version, don't use to store large amouts!
|
||||||
|
</BlueText>
|
||||||
<BlueButton
|
<BlueButton
|
||||||
icon={{name: 'octoface', type: 'octicon'}}
|
icon={{ name: 'octoface', type: 'octicon' }}
|
||||||
onPress={() =>
|
onPress={() => {
|
||||||
{
|
Linking.openURL('https://github.com/Overtorment/BlueWallet');
|
||||||
Linking.openURL("https://github.com/Overtorment/BlueWallet")
|
}}
|
||||||
}
|
|
||||||
}
|
|
||||||
title="github.com/Overtorment/BlueWallet"
|
title="github.com/Overtorment/BlueWallet"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BlueSpacing20/>
|
<BlueSpacing20 />
|
||||||
<BlueText h4>Licensed MIT</BlueText>
|
<BlueText h4>Licensed MIT</BlueText>
|
||||||
<BlueSpacing20/>
|
<BlueSpacing20 />
|
||||||
|
|
||||||
<BlueText h3>Built with awesome:</BlueText>
|
<BlueText h3>Built with awesome:</BlueText>
|
||||||
<BlueSpacing20/>
|
<BlueSpacing20 />
|
||||||
<BlueText h4>* React Native</BlueText>
|
<BlueText h4>* React Native</BlueText>
|
||||||
<BlueText h4>* Bitcoinjs-lib</BlueText>
|
<BlueText h4>* Bitcoinjs-lib</BlueText>
|
||||||
<BlueText h4>* blockcypher.com API</BlueText>
|
<BlueText h4>* blockcypher.com API</BlueText>
|
||||||
|
@ -89,16 +94,18 @@ export default class Settings extends Component {
|
||||||
<BlueText h4>* rn-nodeify</BlueText>
|
<BlueText h4>* rn-nodeify</BlueText>
|
||||||
<BlueText h4>* bignumber.js</BlueText>
|
<BlueText h4>* bignumber.js</BlueText>
|
||||||
<BlueText h4>* https://github.com/StefanoBalocco/isaac.js</BlueText>
|
<BlueText h4>* https://github.com/StefanoBalocco/isaac.js</BlueText>
|
||||||
<BlueText h4>* Design by https://dribbble.com/chrometaphore</BlueText>
|
<BlueText h4>
|
||||||
|
* Design by https://dribbble.com/chrometaphore
|
||||||
|
</BlueText>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
</BlueCard>
|
</BlueCard>
|
||||||
</SafeBlueArea>
|
</SafeBlueArea>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Settings.propTypes = {
|
||||||
|
navigation: PropTypes.shape({
|
||||||
|
navigate: PropTypes.func,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
import React from 'react'
|
import { StackNavigator } from 'react-navigation';
|
||||||
import { StackNavigator } from 'react-navigation'
|
|
||||||
|
|
||||||
import list from './transactions/list'
|
import list from './transactions/list';
|
||||||
import details from './transactions/details'
|
import details from './transactions/details';
|
||||||
import rbf from './transactions/RBF'
|
import rbf from './transactions/RBF';
|
||||||
import createrbf from './transactions/RBF-create'
|
import createrbf from './transactions/RBF-create';
|
||||||
|
|
||||||
const TransactionsNavigator = StackNavigator({
|
const TransactionsNavigator = StackNavigator(
|
||||||
TransactionsList: {
|
{
|
||||||
screen: list
|
TransactionsList: {
|
||||||
|
screen: list,
|
||||||
|
},
|
||||||
|
TransactionDetails: {
|
||||||
|
screen: details,
|
||||||
|
},
|
||||||
|
RBF: {
|
||||||
|
screen: rbf,
|
||||||
|
},
|
||||||
|
CreateRBF: {
|
||||||
|
screen: createrbf,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
TransactionDetails: {
|
{
|
||||||
screen: details
|
headerMode: 'none',
|
||||||
|
mode: 'modal',
|
||||||
},
|
},
|
||||||
RBF: {
|
);
|
||||||
screen: rbf
|
|
||||||
},
|
|
||||||
CreateRBF: {
|
|
||||||
screen: createrbf
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
headerMode: 'none',
|
|
||||||
mode: 'modal'
|
|
||||||
})
|
|
||||||
|
|
||||||
export default TransactionsNavigator
|
export default TransactionsNavigator;
|
||||||
|
|
|
@ -1,35 +1,37 @@
|
||||||
import React, { Component } from 'react'
|
import { StackNavigator } from 'react-navigation';
|
||||||
import { StackNavigator } from 'react-navigation'
|
|
||||||
|
|
||||||
import WalletsList from './wallets/list'
|
import WalletsList from './wallets/list';
|
||||||
import AddWallet from './wallets/add'
|
import AddWallet from './wallets/add';
|
||||||
import WalletDetails from './wallets/details'
|
import WalletDetails from './wallets/details';
|
||||||
import WalletExport from './wallets/export'
|
import WalletExport from './wallets/export';
|
||||||
import scanQrWifLegacyAddress from './wallets/scanQrWifLegacyAddress'
|
import scanQrWifLegacyAddress from './wallets/scanQrWifLegacyAddress';
|
||||||
import scanQrWifSegwitP2SHAddress from './wallets/scanQrWifSegwitP2SHAddress'
|
import scanQrWifSegwitP2SHAddress from './wallets/scanQrWifSegwitP2SHAddress';
|
||||||
|
|
||||||
const WalletsNavigator = StackNavigator({
|
const WalletsNavigator = StackNavigator(
|
||||||
WalletsList: {
|
{
|
||||||
screen: WalletsList
|
WalletsList: {
|
||||||
|
screen: WalletsList,
|
||||||
|
},
|
||||||
|
AddWallet: {
|
||||||
|
screen: AddWallet,
|
||||||
|
},
|
||||||
|
ScanQrWifLegacyAddress: {
|
||||||
|
screen: scanQrWifLegacyAddress,
|
||||||
|
},
|
||||||
|
ScanQrWifSegwitP2SHAddress: {
|
||||||
|
screen: scanQrWifSegwitP2SHAddress,
|
||||||
|
},
|
||||||
|
WalletDetails: {
|
||||||
|
screen: WalletDetails,
|
||||||
|
},
|
||||||
|
WalletExport: {
|
||||||
|
screen: WalletExport,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
AddWallet: {
|
{
|
||||||
screen: AddWallet
|
headerMode: 'none',
|
||||||
|
mode: 'modal',
|
||||||
},
|
},
|
||||||
ScanQrWifLegacyAddress: {
|
);
|
||||||
screen: scanQrWifLegacyAddress
|
|
||||||
},
|
|
||||||
ScanQrWifSegwitP2SHAddress: {
|
|
||||||
screen: scanQrWifSegwitP2SHAddress
|
|
||||||
},
|
|
||||||
WalletDetails: {
|
|
||||||
screen: WalletDetails
|
|
||||||
},
|
|
||||||
WalletExport: {
|
|
||||||
screen: WalletExport
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
headerMode: 'none',
|
|
||||||
mode: 'modal'
|
|
||||||
})
|
|
||||||
|
|
||||||
export default WalletsNavigator
|
export default WalletsNavigator;
|
||||||
|
|
Loading…
Add table
Reference in a new issue