diff --git a/Libraries/Utilities/__tests__/MatrixMath-test.js b/Libraries/Utilities/__tests__/MatrixMath-test.js index 4ca108e39..5bfa1e9d7 100644 --- a/Libraries/Utilities/__tests__/MatrixMath-test.js +++ b/Libraries/Utilities/__tests__/MatrixMath-test.js @@ -17,6 +17,10 @@ function degreesToRadians(degrees) { return degrees * Math.PI / 180; } +function convertZeroes(degrees) { + return degrees.map(value => value === -0 ? 0 : value); +} + describe('MatrixMath', () => { it('decomposes a 4x4 matrix to produce accurate Z-axis angles', () => { @@ -26,11 +30,11 @@ describe('MatrixMath', () => { [30, 45, 60, 75, 90, 100, 115, 120, 133, 167].forEach(angle => { var mat = MatrixMath.createRotateZ(degreesToRadians(angle)); - expect(MatrixMath.decomposeMatrix(mat).rotationDegrees) + expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees)) .toEqual([0, 0, angle]); mat = MatrixMath.createRotateZ(degreesToRadians(-angle)); - expect(MatrixMath.decomposeMatrix(mat).rotationDegrees) + expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees)) .toEqual([0, 0, -angle]); }); @@ -51,7 +55,7 @@ describe('MatrixMath', () => { // 360 is expressed as 0 expect(MatrixMath.decomposeMatrix( MatrixMath.createRotateZ(degreesToRadians(360)) - ).rotationDegrees).toEqual([0, 0, 0]); + ).rotationDegrees).toEqual([0, 0, -0]); expect(MatrixMath.decomposeMatrix( MatrixMath.createRotateZ(degreesToRadians(33.33333333)) @@ -83,12 +87,12 @@ describe('MatrixMath', () => { [30, 45, 60, 75, 90, 100, 110, 120, 133, 167].forEach(angle => { mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateYCommand(mat, degreesToRadians(angle)); - expect(MatrixMath.decomposeMatrix(mat).rotationDegrees) + expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees)) .toEqual([0, angle, 0]); mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateYCommand(mat, degreesToRadians(-angle)); - expect(MatrixMath.decomposeMatrix(mat).rotationDegrees) + expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees)) .toEqual([0, -angle, 0]); }); @@ -115,7 +119,7 @@ describe('MatrixMath', () => { [30, 45, 60, 75, 90, 100, 110, 120, 133, 167].forEach(angle => { mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateXCommand(mat, degreesToRadians(angle)); - expect(MatrixMath.decomposeMatrix(mat).rotationDegrees) + expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees)) .toEqual([angle, 0, 0]); }); diff --git a/Libraries/Utilities/__tests__/MessageQueue-test.js b/Libraries/Utilities/__tests__/MessageQueue-test.js index 8b9b689fd..64c4c1c1a 100644 --- a/Libraries/Utilities/__tests__/MessageQueue-test.js +++ b/Libraries/Utilities/__tests__/MessageQueue-test.js @@ -55,15 +55,15 @@ describe('MessageQueue', () => { }); it('should call a local function with id', () => { - expect(TestModule.testHook1.callCount).toEqual(0); + expect(TestModule.testHook1.calls.count()).toEqual(0); queue.__callFunction(0, 0, [1]); - expect(TestModule.testHook1.callCount).toEqual(1); + expect(TestModule.testHook1.calls.count()).toEqual(1); }); it('should call a local function with the function name', () => { - expect(TestModule.testHook2.callCount).toEqual(0); + expect(TestModule.testHook2.calls.count()).toEqual(0); queue.__callFunction('one', 'testHook2', [2]); - expect(TestModule.testHook2.callCount).toEqual(1); + expect(TestModule.testHook2.calls.count()).toEqual(1); }); it('should generate native modules', () => { @@ -78,7 +78,7 @@ describe('MessageQueue', () => { assertQueue(flushedQueue, 0, 0, 1, ['foo', 0, 1]); }); - it('should call the stored callback', (done) => { + it('should call the stored callback', () => { var done = false; queue.RemoteModules.one.remoteMethod1(() => { done = true; }); queue.__invokeCallback(1); diff --git a/package.json b/package.json index 7f47f5a9b..b36379dd2 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "^image![a-zA-Z0-9$_-]+$": "GlobalImageStub", "^[./a-zA-Z0-9$_-]+\\.png$": "RelativeImageStub" }, + "testRunner": "/node_modules/jest-cli/src/testRunners/jasmine/jasmine2.js", "testPathIgnorePatterns": [ "/node_modules/" ], diff --git a/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js b/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js index ad0dcf279..39d687881 100644 --- a/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js +++ b/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js @@ -34,8 +34,7 @@ describe('loadBundles', () => { pit('shouldn\'t request already loaded bundles', () => { loadBundles.mockImpl((bundles, callback) => callback()); - return global - .__loadBundles(['bundle.0']) + return global.__loadBundles(['bundle.0']) .then(() => global.__loadBundles(['bundle.0'])) .then(() => expect(loadBundlesCalls.length).toBe(1)); }); diff --git a/packager/react-packager/src/Resolver/polyfills/loadBundles.js b/packager/react-packager/src/Resolver/polyfills/loadBundles.js index 551d4cac2..4e893eda9 100644 --- a/packager/react-packager/src/Resolver/polyfills/loadBundles.js +++ b/packager/react-packager/src/Resolver/polyfills/loadBundles.js @@ -1,7 +1,7 @@ /* eslint global-strict:0 */ (global => { let loadBundlesOnNative = (bundles) => - new Promise((_, resolve) => + new Promise((resolve) => require('NativeModules').RCTBundlesLoader.loadBundles(bundles, resolve)); let requestedBundles = Object.create(null);