UNPKG

react-native-reanimated-carousel

Version:

Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.

2 lines 4.38 kB
var _reactNativeReanimated=require("react-native-reanimated");var _reactHooks=require("@testing-library/react-hooks");var _handleroffsetDirection=require("./handleroffset-direction");describe("handlerOffsetDirection",function(){it("should return -1 when default value equals to zero",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(0);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(-1);});it("should return 1 when default value is greater than zero",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(1);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(1);});it("should return -1 when default value is less than zero",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(-1);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(-1);});it("should return 1 when default value equals to zero and fixedDirection is negative",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(-1);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal,"positive");});expect(result.result.current).toBe(1);});it("should return -1 when default value is greater than zero and fixedDirection is negative",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(1);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal,"negative");});expect(result.result.current).toBe(-1);});it("should handle fractional positive values",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(0.5);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(1);});it("should handle fractional negative values",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(-0.5);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(-1);});it("should handle large positive values",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(1000);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(1);});it("should handle large negative values",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(-1000);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(-1);});it("should override with positive fixed direction",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(-100);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal,"positive");});expect(result.result.current).toBe(1);});it("should override with negative fixed direction",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(100);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal,"negative");});expect(result.result.current).toBe(-1);});it("should handle very small positive values",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(0.001);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(1);});it("should handle very small negative values",function(){var result=(0,_reactHooks.renderHook)(function(){var handlerOffsetAnimVal=(0,_reactNativeReanimated.useSharedValue)(-0.001);return(0,_handleroffsetDirection.handlerOffsetDirection)(handlerOffsetAnimVal);});expect(result.result.current).toBe(-1);});}); //# sourceMappingURL=handleroffset-direction.test.js.map