small refactor in tests
This commit is contained in:
parent
1069619af1
commit
313ebee63d
|
@ -539,11 +539,16 @@ describe('Copay server', function() {
|
|||
|
||||
|
||||
describe('#verifyMessageSignature', function() {
|
||||
beforeEach(function() {
|
||||
var server, wallet;
|
||||
beforeEach(function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(s, w) {
|
||||
server = s;
|
||||
wallet = w;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should successfully verify message signature', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(server) {
|
||||
var opts = {
|
||||
message: aText,
|
||||
signature: aTextSignature,
|
||||
|
@ -554,10 +559,8 @@ describe('Copay server', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail to verify message signature for different copayer', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function() {
|
||||
var opts = {
|
||||
message: aText,
|
||||
signature: aTextSignature,
|
||||
|
@ -571,14 +574,18 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#createAddress', function() {
|
||||
beforeEach(function() {
|
||||
var server, wallet;
|
||||
beforeEach(function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(s, w) {
|
||||
server = s;
|
||||
wallet = w;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should create main address', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(server) {
|
||||
server.createAddress({
|
||||
isChange: false,
|
||||
}, function(err, address) {
|
||||
|
@ -589,11 +596,9 @@ describe('Copay server', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should create change address', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(server) {
|
||||
server.createAddress({
|
||||
isChange: true,
|
||||
}, function(err, address) {
|
||||
|
@ -604,10 +609,8 @@ describe('Copay server', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should create many addresses on simultaneous requests', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(server) {
|
||||
async.map(_.range(10), function(i, cb) {
|
||||
server.createAddress({
|
||||
isChange: false,
|
||||
|
@ -621,11 +624,8 @@ describe('Copay server', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should not create address if unable to store wallet', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(server) {
|
||||
|
||||
var storeWalletStub = sinon.stub(server.storage, 'storeWallet');
|
||||
storeWalletStub.yields('dummy error');
|
||||
|
||||
|
@ -651,11 +651,8 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should not create address if unable to store addresses', function(done) {
|
||||
helpers.createAndJoinWallet('123', 2, 2, function(server) {
|
||||
|
||||
var storeAddressStub = sinon.stub(server.storage, 'storeAddress');
|
||||
storeAddressStub.yields('dummy error');
|
||||
|
||||
|
@ -682,7 +679,6 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#createTx', function() {
|
||||
var server, wallet;
|
||||
|
|
Loading…
Reference in New Issue