solid-credit
Version:
Solid Credit is an advanced tool designed for the precise generation of loan amortization tables. This library encompasses a variety of loan structures, including the French, German, and American systems, in addition to offering options for grace periods.
27 lines (22 loc) • 979 B
text/typescript
import { expect } from "chai";
import { CustomRounding } from "../../global/utils/customRound.utils";
describe("CustomRounding", () => {
let customRounding: CustomRounding;
beforeEach(() => {
customRounding = new CustomRounding();
});
describe("roundUp", () => {
it("should round up to the nearest integer if decimal part is greater than or equal to 0.75", () => {
expect(customRounding.GetroundUp(1.75)).equal(2);
expect(customRounding.GetroundUp(2.99)).equal(3);
});
it("should round down to the nearest integer if decimal part is less than 0.25", () => {
expect(customRounding.GetroundUp(1.24)).equal(1);
expect(customRounding.GetroundUp(2.01)).equal(2);
});
it("should round up to the nearest half if decimal part is between 0.25 and 0.75", () => {
expect(customRounding.GetroundUp(1.3)).equal(1.5);
expect(customRounding.GetroundUp(2.6)).equal(2.5);
});
});
});