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

267
Views
Test case failed in Jest with " expect(received).toBe(expected) // Object.is equality"

I tried to work on basic Jest testing in JavaScript. I went through the docs file and worked accordingly. Everything look good to me but a simple test case is not passing. I have attached the screenshot for the issue along with the code and package.json.Screenshot Screenshot2

const functions = {
  add: (num1, num2) => {
    num1 + num2;
  },
};

module.exports = functions;


`//Testing `
const functions = require("./functions");

    test("Add 2 + 2 equal 4", () => {
      expect(functions.add(2, 2)).toBe(4);
    });

Error
expect(received).toBeCloseTo(expected)

Matcher error: received value must be a number

Received has value: undefined
about 4 years ago · Juan Pablo Isaza
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!