I'm trying to write a Jasmine test to see if the returned value has two decimal places. It's a monetary value, and I want to be sure there is a period followed by two numbers from 00-99, and I'm guessing that .toContain() would be the matcher to use. But what would go in the parentheses?
it("should return a result with 2 decimal places", function() {
expect(calculateMonthlyPayment(values)).toContain();
});
Use regexp
expect(calculateMonthlyPayment(values).toString()).toMatch(/^\d+\.\d\d$/);