Skip to content

Commit

Permalink
Configure travis
Browse files Browse the repository at this point in the history
  • Loading branch information
garywang committed Aug 7, 2020
1 parent 7a86987 commit cb32d5e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js: 10
dist: bionic
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"eslintConfig": {
"extends": "react-app"
},
"jest": {
"transformIgnorePatterns": [
"^.+\\.cjs$"
]
},
"browserslist": {
"production": [
">0.2%",
Expand Down
8 changes: 5 additions & 3 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -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();
});
6 changes: 3 additions & 3 deletions src/utils/wallet-seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cb32d5e

Please sign in to comment.