UNPKG

node-finance

Version:

Financial functions for NodeJS

33 lines (25 loc) 951 B
"use strict"; var finance = require('../finance'); describe("calcInterest", function () { var calcInterest; var amount = 1000; var months = 10; var payment = 105; var expectedResult = 10.76498031616211; beforeEach(function (){ calcInterest = finance.calcInterest; }); describe("Test synchronous interface", function () { it("calculates interest rate in synchronous mode", function () { var actualResult = calcInterest(amount, months, payment); expect(actualResult).toEqual(expectedResult); }); }); describe("Test Node-Style asynchronous interface", function () { it("calculates interest rate in asynchronous mode and returns in familiar node (err, result) format", function () { calcInterest(amount, months, payment, function(err, result){ expect(result).toEqual(expectedResult); }); }); }); });