Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

99
Vistas
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
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos