react-native-reanimated-carousel
Version:
Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.
2 lines • 3.34 kB
JavaScript
var _log=require("./log");describe("log utilities",function(){describe("log",function(){var mockConsoleLog=jest.fn();var originalConsoleLog=console.log;beforeEach(function(){console.log=mockConsoleLog;});afterEach(function(){mockConsoleLog.mockClear();console.log=originalConsoleLog;});it("should call console.log with provided arguments",function(){var _expect;var args=["test",123,{key:"value"}];_log.log.apply(void 0,args);(_expect=expect(mockConsoleLog)).toHaveBeenCalledWith.apply(_expect,args);});it("should handle single argument",function(){(0,_log.log)("test");expect(mockConsoleLog).toHaveBeenCalledWith("test");});it("should handle multiple arguments",function(){(0,_log.log)("test",123,true);expect(mockConsoleLog).toHaveBeenCalledWith("test",123,true);});it("should handle no arguments",function(){(0,_log.log)();expect(mockConsoleLog).toHaveBeenCalledWith();});it("should handle null and undefined",function(){(0,_log.log)(null,undefined);expect(mockConsoleLog).toHaveBeenCalledWith(null,undefined);});it("should handle complex objects",function(){var complexObj={nested:{array:[1,2,3]},func:function func(){return"test";},date:new Date("2023-01-01")};(0,_log.log)(complexObj);expect(mockConsoleLog).toHaveBeenCalledWith(complexObj);});it("should handle arrays",function(){var arr=[1,"two",{three:3}];(0,_log.log)(arr);expect(mockConsoleLog).toHaveBeenCalledWith(arr);});it("should handle mixed types",function(){(0,_log.log)("string",42,true,null,undefined,{key:"value"},[1,2,3]);expect(mockConsoleLog).toHaveBeenCalledWith("string",42,true,null,undefined,{key:"value"},[1,2,3]);});});describe("round",function(){it("should round positive numbers correctly",function(){expect((0,_log.round)(1.4)).toBe(1);expect((0,_log.round)(1.5)).toBe(2);expect((0,_log.round)(1.6)).toBe(2);});it("should round negative numbers correctly",function(){expect((0,_log.round)(-1.4)).toBe(-1);expect((0,_log.round)(-1.5)).toBe(-1);expect((0,_log.round)(-1.6)).toBe(-2);});it("should handle zero values",function(){expect((0,_log.round)(0)).toBe(0);expect((0,_log.round)(-0)).toBe(-0);expect(1/(0,_log.round)(-0)).toBe(Number.NEGATIVE_INFINITY);});it("should handle integers",function(){expect((0,_log.round)(5)).toBe(5);expect((0,_log.round)(-5)).toBe(-5);});it("should handle decimal places",function(){expect((0,_log.round)(Math.PI)).toBe(3);expect((0,_log.round)(-Math.PI)).toBe(-3);});it("should handle edge cases",function(){expect((0,_log.round)(0.5)).toBe(1);expect((0,_log.round)(-0.5)).toBe(-0);expect((0,_log.round)(1.999999)).toBe(2);expect((0,_log.round)(-1.999999)).toBe(-2);});it("should handle very large numbers",function(){expect((0,_log.round)(1e10+0.4)).toBe(1e10);expect((0,_log.round)(1e10+0.6)).toBe(1e10+1);});it("should handle very small numbers",function(){expect((0,_log.round)(0.00001)).toBe(0);expect((0,_log.round)(-0.00001)).toBe(-0);});it("should handle Infinity",function(){expect((0,_log.round)(Number.POSITIVE_INFINITY)).toBe(Number.POSITIVE_INFINITY);expect((0,_log.round)(Number.NEGATIVE_INFINITY)).toBe(Number.NEGATIVE_INFINITY);});it("should handle NaN",function(){expect((0,_log.round)(Number.NaN)).toBe(Number.NaN);});it("should handle floating point precision issues",function(){expect((0,_log.round)(0.1+0.2)).toBe(0);expect((0,_log.round)(1.1+1.2)).toBe(2);});});});
//# sourceMappingURL=log.test.js.map