lundi 7 mai 2018

Jest react-native, expect constant to be a be a [Function BezierEasing]

I've got this constant in react native that just sets certain bezier easing

const easeInQuad = Easing.bezier(0.55, 0.085, 0.68, 0.53);

and associated jest test

test("Animation/easeInQuad should return correct value", () => {
  expect(easeInQuad).toBe("[Function BezierEasing]");
});

it currently outputs the following

Animation/easeInQuad should return correct value

expect(received).toBe(expected) // Object.is equality

Expected value to be:
  "[Function BezierEasing]"
Received:
  [Function BezierEasing]

Difference:

  Comparing two different types of values. Expected string but received function.

What do I need to pass to expect in order to match what is being output?

Aucun commentaire:

Enregistrer un commentaire