2018-03-18 16:15:10 +01:00
|
|
|
/* global describe, it, expect, jest */
|
|
|
|
import React from 'react';
|
2018-03-17 21:39:21 +01:00
|
|
|
import { LegacyWallet } from './class';
|
2018-03-18 16:15:10 +01:00
|
|
|
import renderer from 'react-test-renderer';
|
|
|
|
import App from './App';
|
|
|
|
import Settings from './screen/settings';
|
|
|
|
import { BlueHeader } from './BlueComponents';
|
2018-03-17 21:39:21 +01:00
|
|
|
let assert = require('assert');
|
2018-03-18 16:15:10 +01:00
|
|
|
jest.mock('react-native-qrcode', () => 'Video');
|
2018-03-17 15:27:37 +01:00
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
describe('unit - LegacyWallet', function() {
|
2018-03-17 15:27:37 +01:00
|
|
|
it('serialize and unserialize work correctly', () => {
|
2018-03-17 21:39:21 +01:00
|
|
|
let a = new LegacyWallet();
|
|
|
|
a.setLabel('my1');
|
|
|
|
let key = JSON.stringify(a);
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
let b = LegacyWallet.fromJson(key);
|
|
|
|
assert(key === JSON.stringify(b));
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
assert.equal(key, JSON.stringify(b));
|
|
|
|
});
|
|
|
|
});
|
2018-03-18 16:15:10 +01:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|