|
1 | 1 | /* eslint-env mocha */
|
2 | 2 | 'use strict'
|
3 | 3 |
|
| 4 | +const { Buffer } = require('buffer') |
4 | 5 | const chai = require('chai')
|
5 | 6 | const dirtyChai = require('dirty-chai')
|
6 | 7 | chai.use(dirtyChai)
|
@@ -43,26 +44,17 @@ describe('multihashing', () => {
|
43 | 44 | })
|
44 | 45 |
|
45 | 46 | describe('validate', () => {
|
46 |
| - it('true on pass', done => { |
47 |
| - multihashing(Buffer.from('test'), 'sha2-256', (err, hash) => { |
48 |
| - if (err) throw done(err) |
49 |
| - multihashing.validate(Buffer.from('test'), hash, (err, bool) => { |
50 |
| - if (err) throw done(err) |
51 |
| - expect(bool).to.eql(true) |
52 |
| - done() |
53 |
| - }) |
54 |
| - }) |
| 47 | + it('true on pass', async () => { |
| 48 | + const hash = await multihashing(Buffer.from('test'), 'sha2-256') |
| 49 | + const validation = await multihashing.validate(Buffer.from('test'), hash) |
| 50 | + |
| 51 | + return expect(validation).to.eql(true) |
55 | 52 | })
|
56 | 53 |
|
57 |
| - it('false on fail', done => { |
58 |
| - multihashing(Buffer.from('test'), 'sha2-256', (err, hash) => { |
59 |
| - if (err) throw done(err) |
60 |
| - multihashing.validate(Buffer.from('test-fail'), hash, (err, bool) => { |
61 |
| - if (err) throw done(err) |
62 |
| - expect(bool).to.eql(false) |
63 |
| - done() |
64 |
| - }) |
65 |
| - }) |
| 54 | + it('false on fail', async () => { |
| 55 | + const hash = await multihashing(Buffer.from('test'), 'sha2-256') |
| 56 | + const validation = await multihashing.validate(Buffer.from('test-fail'), hash) |
| 57 | + return expect(validation).to.eql(false) |
66 | 58 | })
|
67 | 59 | })
|
68 | 60 |
|
|
0 commit comments