Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

387
Views
How can you use Jasmine to check if a value has two decimal places

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();
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use regexp

 expect(calculateMonthlyPayment(values).toString()).toMatch(/^\d+\.\d\d$/);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!