Browse Source

Add tests

pull/2/head
Luke Childs 6 years ago
parent
commit
f418424144
  1. 8
      .travis.yml
  2. 6
      package.json
  3. 17
      test/unit.js

8
.travis.yml

@ -0,0 +1,8 @@
language: node_js
node_js:
- '8'
script: npm test
after_success: npm run coverage
notifications:
email:
on_success: never

6
package.json

@ -5,13 +5,17 @@
"author": "Luke Childs <lukechilds123@gmail.com>",
"license": "MIT",
"scripts": {
"test": "xo"
"test": "xo && nyc ava",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"dependencies": {
"bip39": "^2.5.0",
"randombytes": "^2.0.6"
},
"devDependencies": {
"ava": "^0.25.0",
"coveralls": "^3.0.2",
"nyc": "^13.1.0",
"xo": "^0.23.0"
}
}

17
test/unit.js

@ -0,0 +1,17 @@
import test from 'ava';
import dogeSeed from '..';
test('Seed phrases contain the words "much", "such" and "very"', t => {
const words = [...new Set(
new Array(1000)
.fill()
.map(dogeSeed)
.map(seedPhrase => [seedPhrase.split(' ')[0], seedPhrase.split(' ')[2]])
.reduce((a, b) => a.concat(b), [])
)];
t.is(words.length, 3);
t.true(words.includes('much'));
t.true(words.includes('such'));
t.true(words.includes('very'));
});
Loading…
Cancel
Save