Skip to content

Commit

Permalink
Merge pull request #824 from ashishra0/add-transaction-description
Browse files Browse the repository at this point in the history
add transaction description method on finance module
  • Loading branch information
Marak authored Aug 24, 2020
2 parents 2dabd60 + be49c81 commit 80c847e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,22 @@ self.litecoinAddress = function () {
prob < 40 ?
Helpers.replaceSymbols("###") : "");
};

/**
* description
*
* @method faker.finance.transactionDescription
*/
self.transactionDescription = function() {
var account = Helpers.createTransaction().account
var card = faker.finance.mask();
var currency = faker.finance.currencyCode();
var amount = Helpers.createTransaction().amount
var transactionType = Helpers.createTransaction().type
var company = Helpers.createTransaction().business
return transactionType + " transaction at " + company + " using card ending with ***" + card + " for " + currency + " " + amount + " in account ***" + account
}

};

module['exports'] = Finance;
8 changes: 8 additions & 0 deletions test/finance.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,12 @@ describe('finance.js', function () {
assert.ok(bic.match(expr));
});
});

describe("transactionDescription()", function() {
it("returns a random transaction description", function() {
var transactionDescription = faker.finance.transactionDescription();

assert.ok(transactionDescription);
})
})
});

0 comments on commit 80c847e

Please sign in to comment.