mirror of https://github.com/BTCPrivate/copay.git
Added a test to PublicKeyRing to increase coverage
This commit is contained in:
parent
f8c665ce2e
commit
d4ce4e3c01
|
@ -43,9 +43,9 @@ PublicKeyRing.trim = function(data) {
|
|||
};
|
||||
|
||||
PublicKeyRing.fromObj = function(data) {
|
||||
if (data instanceof PublicKeyRing) {
|
||||
throw new Error('bad data format: Did you use .toObj()?');
|
||||
}
|
||||
preconditions.checkArgument(typeof data !== 'PublicKeyRing');
|
||||
|
||||
|
||||
var opts = PublicKeyRing.trim(data);
|
||||
|
||||
// Support old indexes schema
|
||||
|
|
|
@ -434,6 +434,21 @@ describe('PublicKeyRing model', function() {
|
|||
w.nicknameForIndex(4).should.equal('juan1');
|
||||
});
|
||||
|
||||
it('#fromObj with error', function() {
|
||||
|
||||
var config = {
|
||||
networkName: 'livenet',
|
||||
};
|
||||
var pkr = new PublicKeyRing(config);
|
||||
|
||||
|
||||
(function ()
|
||||
{
|
||||
PublicKeyRing.fromObj(pkr);
|
||||
}
|
||||
).should.throw('bad data format: Did you use .toObj()?');
|
||||
});
|
||||
|
||||
|
||||
it('#toObj #fromObj with nickname', function() {
|
||||
var config = {
|
||||
|
|
Loading…
Reference in New Issue