Skip to content

Commit

Permalink
test(test/sign.js): Simplify sign test
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Jul 23, 2018
1 parent 007a3a1 commit b351f0c
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions test/sign.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
const { keyPair } = require('../key-pair')
const { sign } = require('../sign')
const isBuffer = require('is-buffer')
const ed25519 = require('../ed25519')
const test = require('ava')

test('sign(message, secretKey)', async (t) => {
t.throws(() => sign(0, 0), TypeError)
t.throws(() => sign(null, 0), TypeError)
t.throws(() => sign(true, 0), TypeError)
t.throws(() => sign([], 0), TypeError)
t.throws(() => sign('', 0), TypeError)
t.throws(() => sign(Buffer.from(0), 0), TypeError)

t.throws(() => sign(Buffer.from('message'), 0), TypeError)
t.throws(() => sign(Buffer.from('message'), null), TypeError)
t.throws(() => sign(Buffer.from('message'), true), TypeError)
t.throws(() => sign(Buffer.from('message'), []), TypeError)
t.throws(() => sign(Buffer.from('message'), ''), TypeError)
t.throws(() => sign(Buffer.from('message'), Buffer.from(0)), TypeError)

const { secretKey } = keyPair()

t.true(isBuffer(sign(Buffer.from('message'), secretKey)))
test('sign()', async (t) => {
t.true('function' === typeof sign)
t.true(sign === ed25519.sign)
})

0 comments on commit b351f0c

Please sign in to comment.