我已经在反应原生中保持这个常数,只是设置了某些bezier缓和
const easeInQuad = Easing.bezier(0.55, 0.085, 0.68, 0.53);
和相关的玩笑测试
test("Animation/easeInQuad should return correct value", () => {
expect(easeInQuad).toBe("[Function BezierEasing]");
});
目前输出以下内容
动画/ easeInQuad应该返回正确的值
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.
我需要传递给expect
以匹配输出的内容?
答案 0 :(得分:1)
您可以使用Function.name
检查名称,例如
expect(easeInQuad.name).toBe("BezierEasing");
可能还值得检查它是否是第一个功能:
expect(easeInQuad).toBeInstanceOf(Function);