Added a test to PublicKeyRing to increase coverage
This commit is contained in:
parent
f8c665ce2e
commit
d4ce4e3c01
2 changed files with 18 additions and 3 deletions
|
|
@ -43,9 +43,9 @@ PublicKeyRing.trim = function(data) {
|
||||||
};
|
};
|
||||||
|
|
||||||
PublicKeyRing.fromObj = function(data) {
|
PublicKeyRing.fromObj = function(data) {
|
||||||
if (data instanceof PublicKeyRing) {
|
preconditions.checkArgument(typeof data !== 'PublicKeyRing');
|
||||||
throw new Error('bad data format: Did you use .toObj()?');
|
|
||||||
}
|
|
||||||
var opts = PublicKeyRing.trim(data);
|
var opts = PublicKeyRing.trim(data);
|
||||||
|
|
||||||
// Support old indexes schema
|
// Support old indexes schema
|
||||||
|
|
|
||||||
|
|
@ -434,6 +434,21 @@ describe('PublicKeyRing model', function() {
|
||||||
w.nicknameForIndex(4).should.equal('juan1');
|
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() {
|
it('#toObj #fromObj with nickname', function() {
|
||||||
var config = {
|
var config = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue