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

0

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

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.