Browse Source

Fix tests

patch-2
Yemel Jardi 10 years ago
parent
commit
d584febea0
  1. 4
      test/hdprivatekey.js
  2. 6
      test/util/preconditions.js

4
test/hdprivatekey.js

@ -47,7 +47,7 @@ describe('HDPrivate key interface', function() {
}; };
it('should make a new private key from random', function() { it('should make a new private key from random', function() {
(new HDPrivateKey().xprivkey).should.exist(); should.exist(new HDPrivateKey().xprivkey);
}); });
it('should error with an invalid checksum', function() { it('should error with an invalid checksum', function() {
@ -135,7 +135,7 @@ describe('HDPrivate key interface', function() {
describe('on creation from seed', function() { describe('on creation from seed', function() {
it('converts correctly from an hexa string', function() { it('converts correctly from an hexa string', function() {
HDPrivateKey.fromSeed('01234567890abcdef01234567890abcdef').xprivkey.should.exist(); should.exist(HDPrivateKey.fromSeed('01234567890abcdef01234567890abcdef').xprivkey);
}); });
it('fails when argument is not a buffer or string', function() { it('fails when argument is not a buffer or string', function() {
expectSeedFail(1, hdErrors.InvalidEntropyArgument); expectSeedFail(1, hdErrors.InvalidEntropyArgument);

6
test/util/preconditions.js

@ -1,5 +1,7 @@
'use strict'; 'use strict';
var should = require('chai').should();
var errors = require('../../lib/errors'); var errors = require('../../lib/errors');
var $ = require('../../lib/util/preconditions'); var $ = require('../../lib/util/preconditions');
var PrivateKey = require('../../lib/privatekey'); var PrivateKey = require('../../lib/privatekey');
@ -35,7 +37,7 @@ describe('preconditions', function() {
error = e; error = e;
e.message.should.equal('Invalid Argument for argumentName, expected string but got number'); e.message.should.equal('Invalid Argument for argumentName, expected string but got number');
} }
error.should.exist(); should.exist(error);
}); });
it('has no false negatives when used to check an argument type', function() { it('has no false negatives when used to check an argument type', function() {
(function() { (function() {
@ -51,7 +53,7 @@ describe('preconditions', function() {
error = e; error = e;
e.message.should.equal('Invalid Argument for (unknown name), expected PrivateKey but got number'); e.message.should.equal('Invalid Argument for (unknown name), expected PrivateKey but got number');
} }
error.should.exist(); should.exist(error);
}); });
it('has no false negatives when checking a type for a class', function() { it('has no false negatives when checking a type for a class', function() {
(function() { (function() {

Loading…
Cancel
Save