Skip to content

Commit

Permalink
Merge pull request #591 from johnmaia/bugfix/bitcoin-address
Browse files Browse the repository at this point in the history
Fix bitcoinAddress generator
  • Loading branch information
Marak authored Sep 25, 2018
2 parents fab40fc + 06816ad commit 6d05e15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ var Finance = function (faker) {
* @method faker.finance.bitcoinAddress
*/
self.bitcoinAddress = function () {
var addressLength = faker.random.number({ min: 27, max: 34 });
var addressLength = faker.random.number({ min: 25, max: 34 });

var address = faker.random.arrayElement(['1', '3']);

for (var i = 0; i < addressLength - 1; i++)
address += faker.random.alphaNumeric().toUpperCase();
address += faker.random.arrayElement('123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'.split(''));

return address;
}
Expand Down
6 changes: 3 additions & 3 deletions test/finance.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ describe('finance.js', function () {
it("returns a random bitcoin address", function(){
var bitcoinAddress = faker.finance.bitcoinAddress();

assert.ok(bitcoinAddress.match(/^[A-Z0-9.]{27,34}$/));
assert.ok(bitcoinAddress.match(/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/));
});
});

Expand Down Expand Up @@ -308,15 +308,15 @@ describe('finance.js', function () {
assert.ok(luhnFormula(number));
});
});

describe("creditCardCVV()", function(){
it("returns a random credit card CVV", function(){
var cvv = faker.finance.creditCardCVV();
assert.ok(cvv.length === 3);
assert.ok(cvv.match(/^[0-9]{3}$/));
});
});


describe("iban()", function () {
var ibanLib = require('../lib/iban');
Expand Down

0 comments on commit 6d05e15

Please sign in to comment.