add tests
This commit is contained in:
parent
4e87dfe548
commit
4db7a80775
|
@ -149,6 +149,28 @@ describe('client API ', function() {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
describe('#export & #import 2-2 wallet', function() {
|
||||
it('round trip ', function(done) {
|
||||
client.storage.fs.readFile = sinon.stub().yields(null, JSON.stringify(TestData.storage.complete22));
|
||||
client.export(function(err, str) {
|
||||
should.not.exist(err);
|
||||
|
||||
client.storage.fs.readFile = sinon.stub().yields(null);
|
||||
client.import(str, function(err,wallet) {
|
||||
should.not.exist(err);
|
||||
var wallet = JSON.parse(client.storage.fs.writeFile.getCall(0).args[1]);
|
||||
|
||||
TestData.storage.complete22.should.deep.equal(wallet);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe('#signTxProposal ', function() {
|
||||
it.skip('should sign tx proposal', function(done) {});
|
||||
|
||||
|
|
|
@ -13,14 +13,22 @@ var storage = {
|
|||
incompleteWallet22: {
|
||||
"m": 2,
|
||||
"n": 2,
|
||||
"walletPrivKey":"L2Fu6TM1AqSNBaQcjgjvYjGf3EzS3MVSTwEeTw3bvy52x7ZkffWj",
|
||||
"walletPrivKey": "L2Fu6TM1AqSNBaQcjgjvYjGf3EzS3MVSTwEeTw3bvy52x7ZkffWj",
|
||||
"network": "testnet",
|
||||
"secret": "b6f57154-0df8-4845-a61d-47ecd648c2d4:eab5a55d9214845ee8d13ea1033e42ec8d7f780ae6e521d830252a80433e91a5:T",
|
||||
"xPrivKey": "tprv8ZgxMBicQKsPfFVXegcKyJjy2Y5DSrHNrtGBHG1f9pPX75QQdHwHGjWUtR7cCUXV7QcCCDon4cieHWTYscy8M7oXwF3qd3ssfBiV9M68bPB",
|
||||
"copayerId": "3fc03e7a-6ebc-409b-a4b7-45b14d5a8199",
|
||||
"signingPrivKey": "0d3c796fb12e387c4b5a5c566312b2b22fa0553ca041d859e3f0987215ca3a4f",
|
||||
"publicKeyRing": []
|
||||
}
|
||||
},
|
||||
complete22: {
|
||||
"xPrivKey": "xprv9s21ZrQH143K3nwnRt6W25h7smm4k4nbuN4QKnNkTMDHFcB11wJXYF78TpwQ3xKjik9M66nRd9WUiHB5C8XgoWSbpMRMc2AxpcUNUsi4thi",
|
||||
"m": 2,
|
||||
"publicKeyRing": ["xpub661MyMwAqRbcGzNFbVQLh6CV6ukHuhBn4Bf4CGrQ6pFfNNdJ3pxrEVDtFHGsTzyz6Py23FhP8GWAqew3PsvnstEs2iayH1PK5Mx1bSVSEAG", "xpub661MyMwAqRbcGH2FXudWPDdrRobZ9XWTGaz18AnN1gkG8QW9ZUcn63RcK5qJJ5DXYXeAWBNqprdvvg8VHA5twmBHCUc6gWygXkwmU1Dohwh"],
|
||||
"copayerId": "020b41cfea5fae42050580474a195a8385b093f291af4079759851d8819383a680",
|
||||
"signingPrivKey": "KyhU3befBaePqHuPQNNyY1XFUgnArR3GUKZpZwV5vS7u1pcR3uzB",
|
||||
"network": "livenet"
|
||||
},
|
||||
};
|
||||
|
||||
var serverResponse = {
|
||||
|
@ -42,7 +50,8 @@ var serverResponse = {
|
|||
}],
|
||||
pubKey: ' { "x": "b2903ab878ed1316f82b859e9807e23bab3d579175563e1068d2ed9c9e37873c", "y": "5f30165915557394223a58329c1527dfa0f34f483d8aed02e0638f9124dbddef", "compressed": true }',
|
||||
network: 'testnet',
|
||||
}},
|
||||
}
|
||||
},
|
||||
|
||||
missingMyPubKey: {
|
||||
wallet: {
|
||||
|
@ -62,7 +71,8 @@ var serverResponse = {
|
|||
}],
|
||||
pubKey: ' { "x": "b2903ab878ed1316f82b859e9807e23bab3d579175563e1068d2ed9c9e37873c", "y": "5f30165915557394223a58329c1527dfa0f34f483d8aed02e0638f9124dbddef", "compressed": true }',
|
||||
network: 'testnet',
|
||||
}},
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
incompleteWallet: {
|
||||
|
@ -80,7 +90,8 @@ var serverResponse = {
|
|||
}],
|
||||
pubKey: ' { "x": "b2903ab878ed1316f82b859e9807e23bab3d579175563e1068d2ed9c9e37873c", "y": "5f30165915557394223a58329c1527dfa0f34f483d8aed02e0638f9124dbddef", "compressed": true }',
|
||||
network: 'testnet',
|
||||
}},
|
||||
}
|
||||
},
|
||||
|
||||
corruptWallet22: {
|
||||
wallet: {
|
||||
|
@ -97,7 +108,8 @@ var serverResponse = {
|
|||
xPubKey: 'tpubD6NzVbkrYhZ4Y1CGuCZ88eZvhDSTjAqjotZWGXC7e4GEoyXq3SQgZK9iRz4qC2h8MrzqrYBndCMQDiaaLdqpY8ihYmJC9Msvns83jGopb3E',
|
||||
xPubKeySignature: 'bababa',
|
||||
}],
|
||||
}},
|
||||
}
|
||||
},
|
||||
corruptWallet222: {
|
||||
wallet: {
|
||||
m: 2,
|
||||
|
@ -109,7 +121,8 @@ var serverResponse = {
|
|||
copayers: [{
|
||||
xPubKey: 'tpubD6NzVbkrYhZ4Y1CGuCZ88eZvhDSTjAqjotZWGXC7e4GEoyXq3SQgZK9iRz4qC2h8MrzqrYBndCMQDiaaLdqpY8ihYmJC9Msvns83jGopb3E',
|
||||
}, ],
|
||||
}},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.serverResponse = serverResponse;
|
||||
|
|
Loading…
Reference in New Issue