Configure travis

This commit is contained in:
Gary Wang 2020-08-06 23:26:32 -07:00
parent 7a8698777e
commit cb32d5ec84
4 changed files with 16 additions and 6 deletions

3
.travis.yml Normal file
View File

@ -0,0 +1,3 @@
language: node_js
node_js: 10
dist: bionic

View File

@ -32,6 +32,11 @@
"eslintConfig": {
"extends": "react-app"
},
"jest": {
"transformIgnorePatterns": [
"^.+\\.cjs$"
]
},
"browserslist": {
"production": [
">0.2%",

View File

@ -1,9 +1,11 @@
import React from 'react';
import { render } from '@testing-library/react';
import { act, render } from '@testing-library/react';
import App from './App';
import { sleep } from './utils/utils';
test('renders learn react link', () => {
test('renders learn react link', async () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
await act(() => sleep(1000));
const linkElement = getByText(/Create New Wallet/i);
expect(linkElement).toBeInTheDocument();
});

View File

@ -7,7 +7,7 @@ export async function generateMnemonicAndSeed() {
const bip39 = await import('bip39');
const mnemonic = bip39.generateMnemonic(128);
const seed = await bip39.mnemonicToSeed(mnemonic);
return { mnemonic, seed: new Buffer(seed).toString('hex') };
return { mnemonic, seed: Buffer.from(seed).toString('hex') };
}
export async function mnemonicToSeed(mnemonic) {
@ -16,7 +16,7 @@ export async function mnemonicToSeed(mnemonic) {
throw new Error('Invalid seed words');
}
const seed = await bip39.mnemonicToSeed(mnemonic);
return new Buffer(seed).toString('hex');
return Buffer.from(seed).toString('hex');
}
let unlockedMnemonicAndSeed = JSON.parse(
@ -86,7 +86,7 @@ export async function loadMnemonicAndSeed(password, stayLoggedIn) {
if (!plaintext) {
throw new Error('Incorrect password');
}
const decodedPlaintext = new Buffer(plaintext).toString();
const decodedPlaintext = Buffer.from(plaintext).toString();
const { mnemonic, seed } = JSON.parse(decodedPlaintext);
if (stayLoggedIn) {
sessionStorage.setItem('unlocked', decodedPlaintext);