Skip to content

Commit b7e939b

Browse files
cpojerfacebook-github-bot-3
authored andcommitted
Update all tests to use Jasmine 2
Reviewed By: vjeux Differential Revision: D2782581 fb-gh-sync-id: 1d938a2bbdd8670c917c1793234dfdcb29fd4511
1 parent 43ca8a0 commit b7e939b

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

Libraries/Utilities/__tests__/MatrixMath-test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ function degreesToRadians(degrees) {
1717
return degrees * Math.PI / 180;
1818
}
1919

20+
function convertZeroes(degrees) {
21+
return degrees.map(value => value === -0 ? 0 : value);
22+
}
23+
2024
describe('MatrixMath', () => {
2125

2226
it('decomposes a 4x4 matrix to produce accurate Z-axis angles', () => {
@@ -26,11 +30,11 @@ describe('MatrixMath', () => {
2630

2731
[30, 45, 60, 75, 90, 100, 115, 120, 133, 167].forEach(angle => {
2832
var mat = MatrixMath.createRotateZ(degreesToRadians(angle));
29-
expect(MatrixMath.decomposeMatrix(mat).rotationDegrees)
33+
expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees))
3034
.toEqual([0, 0, angle]);
3135

3236
mat = MatrixMath.createRotateZ(degreesToRadians(-angle));
33-
expect(MatrixMath.decomposeMatrix(mat).rotationDegrees)
37+
expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees))
3438
.toEqual([0, 0, -angle]);
3539
});
3640

@@ -51,7 +55,7 @@ describe('MatrixMath', () => {
5155
// 360 is expressed as 0
5256
expect(MatrixMath.decomposeMatrix(
5357
MatrixMath.createRotateZ(degreesToRadians(360))
54-
).rotationDegrees).toEqual([0, 0, 0]);
58+
).rotationDegrees).toEqual([0, 0, -0]);
5559

5660
expect(MatrixMath.decomposeMatrix(
5761
MatrixMath.createRotateZ(degreesToRadians(33.33333333))
@@ -83,12 +87,12 @@ describe('MatrixMath', () => {
8387
[30, 45, 60, 75, 90, 100, 110, 120, 133, 167].forEach(angle => {
8488
mat = MatrixMath.createIdentityMatrix();
8589
MatrixMath.reuseRotateYCommand(mat, degreesToRadians(angle));
86-
expect(MatrixMath.decomposeMatrix(mat).rotationDegrees)
90+
expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees))
8791
.toEqual([0, angle, 0]);
8892

8993
mat = MatrixMath.createIdentityMatrix();
9094
MatrixMath.reuseRotateYCommand(mat, degreesToRadians(-angle));
91-
expect(MatrixMath.decomposeMatrix(mat).rotationDegrees)
95+
expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees))
9296
.toEqual([0, -angle, 0]);
9397
});
9498

@@ -115,7 +119,7 @@ describe('MatrixMath', () => {
115119
[30, 45, 60, 75, 90, 100, 110, 120, 133, 167].forEach(angle => {
116120
mat = MatrixMath.createIdentityMatrix();
117121
MatrixMath.reuseRotateXCommand(mat, degreesToRadians(angle));
118-
expect(MatrixMath.decomposeMatrix(mat).rotationDegrees)
122+
expect(convertZeroes(MatrixMath.decomposeMatrix(mat).rotationDegrees))
119123
.toEqual([angle, 0, 0]);
120124
});
121125

Libraries/Utilities/__tests__/MessageQueue-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ describe('MessageQueue', () => {
5555
});
5656

5757
it('should call a local function with id', () => {
58-
expect(TestModule.testHook1.callCount).toEqual(0);
58+
expect(TestModule.testHook1.calls.count()).toEqual(0);
5959
queue.__callFunction(0, 0, [1]);
60-
expect(TestModule.testHook1.callCount).toEqual(1);
60+
expect(TestModule.testHook1.calls.count()).toEqual(1);
6161
});
6262

6363
it('should call a local function with the function name', () => {
64-
expect(TestModule.testHook2.callCount).toEqual(0);
64+
expect(TestModule.testHook2.calls.count()).toEqual(0);
6565
queue.__callFunction('one', 'testHook2', [2]);
66-
expect(TestModule.testHook2.callCount).toEqual(1);
66+
expect(TestModule.testHook2.calls.count()).toEqual(1);
6767
});
6868

6969
it('should generate native modules', () => {
@@ -78,7 +78,7 @@ describe('MessageQueue', () => {
7878
assertQueue(flushedQueue, 0, 0, 1, ['foo', 0, 1]);
7979
});
8080

81-
it('should call the stored callback', (done) => {
81+
it('should call the stored callback', () => {
8282
var done = false;
8383
queue.RemoteModules.one.remoteMethod1(() => { done = true; });
8484
queue.__invokeCallback(1);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"^image![a-zA-Z0-9$_-]+$": "GlobalImageStub",
1818
"^[./a-zA-Z0-9$_-]+\\.png$": "RelativeImageStub"
1919
},
20+
"testRunner": "<rootDir>/node_modules/jest-cli/src/testRunners/jasmine/jasmine2.js",
2021
"testPathIgnorePatterns": [
2122
"/node_modules/"
2223
],

packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ describe('loadBundles', () => {
3434

3535
pit('shouldn\'t request already loaded bundles', () => {
3636
loadBundles.mockImpl((bundles, callback) => callback());
37-
return global
38-
.__loadBundles(['bundle.0'])
37+
return global.__loadBundles(['bundle.0'])
3938
.then(() => global.__loadBundles(['bundle.0']))
4039
.then(() => expect(loadBundlesCalls.length).toBe(1));
4140
});

packager/react-packager/src/Resolver/polyfills/loadBundles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint global-strict:0 */
22
(global => {
33
let loadBundlesOnNative = (bundles) =>
4-
new Promise((_, resolve) =>
4+
new Promise((resolve) =>
55
require('NativeModules').RCTBundlesLoader.loadBundles(bundles, resolve));
66

77
let requestedBundles = Object.create(null);

0 commit comments

Comments
 (0)