From 7bf0f755ed4262be641ae2983e5e2a56aa56f32a Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 3 Feb 2015 16:31:09 -0300 Subject: [PATCH] add test to create many addresses simultaneously --- test/integration.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/integration.js b/test/integration.js index 539ba1a..16a3c42 100644 --- a/test/integration.js +++ b/test/integration.js @@ -586,6 +586,24 @@ describe('Copay server', function() { }); }); + it('should create many addresses on simultaneous requests', function(done) { + helpers.createAndJoinWallet('123', 2, 2, function(err, wallet) { + async.map(_.range(10), function (i, cb) { + server.createAddress({ + walletId: '123', + isChange: false, + }, cb); + }, function (err, addresses) { + addresses.length.should.equal(10); + addresses[0].path.should.equal('m/2147483647/0/1'); + addresses[9].path.should.equal('m/2147483647/0/10'); + // No two identical addresses + _.keys(_.groupBy(addresses, 'address')).length.should.equal(10); + done(); + }); + }); + }); + }); describe('#createTx', function() {