diff options
| author | Ashish Rao <[email protected]> | 2019-09-12 11:23:10 +0530 |
|---|---|---|
| committer | Ashish Rao <[email protected]> | 2019-09-12 11:23:10 +0530 |
| commit | be49c8165cb3ef405ca46435e2c884f934d3f8e4 (patch) | |
| tree | 28e4c61844353fa7a0a0d6818c6a475a09414ec7 | |
| parent | 10bfb9f467b0ac2b8912ffc15690b50ef3244f09 (diff) | |
| download | faker-be49c8165cb3ef405ca46435e2c884f934d3f8e4.tar.xz faker-be49c8165cb3ef405ca46435e2c884f934d3f8e4.zip | |
add transaction description method on finance module
| -rw-r--r-- | lib/finance.js | 16 | ||||
| -rw-r--r-- | test/finance.unit.js | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/finance.js b/lib/finance.js index c16b9e49..c3eb0300 100644 --- a/lib/finance.js +++ b/lib/finance.js @@ -292,6 +292,22 @@ var Finance = function (faker) { 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; diff --git a/test/finance.unit.js b/test/finance.unit.js index bad85884..a665e208 100644 --- a/test/finance.unit.js +++ b/test/finance.unit.js @@ -342,4 +342,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); + }) + }) }); |
