tests: forces consistent import syntax
This commit is contained in:
parent
7cac39633c
commit
7a740c2e7b
12 changed files with 126 additions and 44 deletions
test
|
@ -1,13 +1,14 @@
|
|||
var assert = require('assert')
|
||||
var crypto = require('../').crypto
|
||||
var fixture = require('./fixtures/crypto')
|
||||
var crypto = require('..').crypto
|
||||
|
||||
var fixtures = require('./fixtures/crypto')
|
||||
|
||||
describe('Crypto', function() {
|
||||
describe('HASH160', function() {
|
||||
it('matches the test vector', function() {
|
||||
fixture.before.hex.forEach(function(hex, i) {
|
||||
fixtures.before.hex.forEach(function(hex, i) {
|
||||
var actual = crypto.hash160(new Buffer(hex, 'hex')).toString('hex')
|
||||
var expected = fixture.after.hash160[i]
|
||||
var expected = fixtures.after.hash160[i]
|
||||
|
||||
assert.equal(actual, expected)
|
||||
})
|
||||
|
@ -16,9 +17,9 @@ describe('Crypto', function() {
|
|||
|
||||
describe('HASH256', function() {
|
||||
it('matches the test vector', function() {
|
||||
fixture.before.hex.forEach(function(hex, i) {
|
||||
fixtures.before.hex.forEach(function(hex, i) {
|
||||
var actual = crypto.hash256(new Buffer(hex, 'hex')).toString('hex')
|
||||
var expected = fixture.after.hash256[i]
|
||||
var expected = fixtures.after.hash256[i]
|
||||
|
||||
assert.equal(actual, expected)
|
||||
})
|
||||
|
@ -27,9 +28,9 @@ describe('Crypto', function() {
|
|||
|
||||
describe('SHA1', function() {
|
||||
it('matches the test vector', function() {
|
||||
fixture.before.hex.forEach(function(hex, i) {
|
||||
fixtures.before.hex.forEach(function(hex, i) {
|
||||
var actual = crypto.sha1(new Buffer(hex, 'hex')).toString('hex')
|
||||
var expected = fixture.after.sha1[i]
|
||||
var expected = fixtures.after.sha1[i]
|
||||
|
||||
assert.equal(actual, expected)
|
||||
})
|
||||
|
@ -38,9 +39,9 @@ describe('Crypto', function() {
|
|||
|
||||
describe('SHA256', function() {
|
||||
it('matches the test vector', function() {
|
||||
fixture.before.hex.forEach(function(hex, i) {
|
||||
fixtures.before.hex.forEach(function(hex, i) {
|
||||
var actual = crypto.sha256(new Buffer(hex, 'hex')).toString('hex')
|
||||
var expected = fixture.after.sha256[i]
|
||||
var expected = fixtures.after.sha256[i]
|
||||
|
||||
assert.equal(actual, expected)
|
||||
})
|
||||
|
@ -49,12 +50,12 @@ describe('Crypto', function() {
|
|||
|
||||
describe('HMAC SHA512', function() {
|
||||
it('matches the test vector', function() {
|
||||
fixture.before.hex.forEach(function(hex, i) {
|
||||
fixtures.before.hex.forEach(function(hex, i) {
|
||||
var data = new Buffer(hex, 'hex')
|
||||
var secret = new Buffer(fixture.after.hmacsha512.secret)
|
||||
var secret = new Buffer(fixtures.after.hmacsha512.secret)
|
||||
|
||||
var actual = crypto.HmacSHA512(data, secret)
|
||||
var expected = fixture.after.hmacsha512.hash[i]
|
||||
var expected = fixtures.after.hmacsha512.hash[i]
|
||||
|
||||
assert.equal(actual.toString('hex'), expected)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue