Skip to content

Commit fca7235

Browse files
author
Omar Shehata
authored
Merge pull request #8120 from AnalyticalGraphicsInc/jazzy
Get rid of defineSuite
2 parents e28ce86 + d0af657 commit fca7235

File tree

470 files changed

+2644
-1304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

470 files changed

+2644
-1304
lines changed

Documentation/Contributors/TestingGuide/README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ It is also possible for Karma to run all tests against each browser installed on
192192

193193
#### Run a Single Test or Suite
194194

195-
Sometimes it is useful to run a single test or suite for easier debugging purposes. To do this simply change the `it` function call for the desired test to `fit`, the `f` stands for `focused` in Jasmine speak. Likewise, to run an entire suite, use `fdefineSuite` instead of `defineSuite`.
195+
Sometimes it is useful to run a single test or suite for easier debugging purposes. To do this simply change the `it` function call for the desired test to `fit`, the `f` stands for `focused` in Jasmine speak. Likewise, to run an entire suite, use `fdescribe` instead of `describe`.
196196

197197
## Testing Previous Versions of CesiumJS
198198

@@ -233,22 +233,24 @@ Tests are written in JavaScript using Jasmine. It is important to realize that
233233
Here is a stripped down version of the tests:
234234

235235
```javascript
236-
defineSuite([
236+
define([
237237
'Core/Cartesian3'
238238
], function(
239239
Cartesian3) {
240240
'use strict';
241241

242-
it('construct with default values', function() {
243-
var cartesian = new Cartesian3();
244-
expect(cartesian.x).toEqual(0.0);
245-
expect(cartesian.y).toEqual(0.0);
246-
expect(cartesian.z).toEqual(0.0);
242+
describe('Cartesian3', function(){
243+
it('construct with default values', function() {
244+
var cartesian = new Cartesian3();
245+
expect(cartesian.x).toEqual(0.0);
246+
expect(cartesian.y).toEqual(0.0);
247+
expect(cartesian.z).toEqual(0.0);
248+
});
247249
});
248250
});
249251
```
250252

251-
`defineSuite` identifies this file as a test suite and include modules the same way `define` is used in engine code. The modules are listed in alphabetical order as usual _except_ that the module being tested is listed first.
253+
`describe` identifies this file as a test suite and we include modules the same way `define` is used in engine code.
252254

253255
Using Jasmine, each test is defined by calling `it` and passing a string that describes the test and a function that is the test.
254256

@@ -692,17 +694,18 @@ This test is more cohesive and easier to debug than if it were written using a _
692694

693695
### Categories
694696

695-
As mentioned above, some tests are in the `'WebGL'` category. To assign a category to a suite, pass the category to `defineSuite`.
697+
As mentioned above, some tests are in the `'WebGL'` category. To assign a category to a suite, pass the category to `describe`.
696698

697699
```javascript
698-
defineSuite([
700+
define([
699701
'Scene/DebugModelMatrixPrimitive',
700702
'Specs/createScene'
701703
], function(
702704
DebugModelMatrixPrimitive,
703705
createScene) {
704706
'use strict';
705707

708+
describe('Scene/DebugModelMatrixPrimitive', function(){
706709
var scene;
707710

708711
beforeAll(function() {
@@ -716,9 +719,10 @@ defineSuite([
716719
// ...
717720

718721
}, 'WebGL');
722+
});
719723
```
720724

721-
`defineSuite` is a custom CesiumJS function that wraps Jasmine define calls and provides the category capability.
725+
CesiumJS uses a customized `describe` function that wraps Jasmine describe calls and provides the category capability.
722726

723727
## Manual Testing
724728

@@ -756,7 +760,7 @@ You can run or debug the tests by using the first two buttons. The third button
756760

757761
![](webstorm-test-runner.png)
758762

759-
This runner has lots of options, such as only showing failing tests or automatically re-running the tests on a test interval (great for development when combined with `fdefineSuite`!). You can hover over each of the buttons to see what they do.
763+
This runner has lots of options, such as only showing failing tests or automatically re-running the tests on a test interval (great for development when combined with `fdescribe`!). You can hover over each of the buttons to see what they do.
760764

761765
To make jumping between the source and spec files easier download the [Cesium WebStorm plugin](https://github.com/AnalyticalGraphicsInc/cesium-webstorm-plugin).
762766

Specs/.eslintrc.json

-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"env": {
44
"jasmine": true
55
},
6-
"globals": {
7-
"defineSuite": true
8-
},
96
"rules": {
107
"no-self-assign": "off"
118
}

Specs/Core/ApproximateTerrainHeightsSpec.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
defineSuite([
2-
'Core/ApproximateTerrainHeights',
3-
'Core/Cartesian3',
4-
'Core/Math',
5-
'Core/Rectangle'
6-
], function(
7-
ApproximateTerrainHeights,
8-
Cartesian3,
9-
CesiumMath,
10-
Rectangle) {
11-
'use strict';
1+
define([
2+
'Core/ApproximateTerrainHeights',
3+
'Core/Cartesian3',
4+
'Core/Math',
5+
'Core/Rectangle'
6+
], function(
7+
ApproximateTerrainHeights,
8+
Cartesian3,
9+
CesiumMath,
10+
Rectangle) {
11+
'use strict';
12+
13+
describe('Core/ApproximateTerrainHeights', function() {
1214

1315
beforeAll(function() {
1416
return ApproximateTerrainHeights.initialize();
@@ -68,3 +70,4 @@ defineSuite([
6870
ApproximateTerrainHeights._terrainHeights = heights;
6971
});
7072
});
73+
});

Specs/Core/ArcGISTiledElevationTerrainProviderSpec.js

+30-27
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
defineSuite([
2-
'Core/ArcGISTiledElevationTerrainProvider',
3-
'Core/DefaultProxy',
4-
'Core/GeographicTilingScheme',
5-
'Core/HeightmapTerrainData',
6-
'Core/Math',
7-
'Core/Request',
8-
'Core/RequestScheduler',
9-
'Core/Resource',
10-
'Core/RuntimeError',
11-
'Core/TerrainProvider',
12-
'Core/WebMercatorTilingScheme',
13-
'Specs/pollToPromise'
14-
], function(
15-
ArcGISTiledElevationTerrainProvider,
16-
DefaultProxy,
17-
GeographicTilingScheme,
18-
HeightmapTerrainData,
19-
CesiumMath,
20-
Request,
21-
RequestScheduler,
22-
Resource,
23-
RuntimeError,
24-
TerrainProvider,
25-
WebMercatorTilingScheme,
26-
pollToPromise) {
27-
'use strict';
1+
define([
2+
'Core/ArcGISTiledElevationTerrainProvider',
3+
'Core/DefaultProxy',
4+
'Core/GeographicTilingScheme',
5+
'Core/HeightmapTerrainData',
6+
'Core/Math',
7+
'Core/Request',
8+
'Core/RequestScheduler',
9+
'Core/Resource',
10+
'Core/RuntimeError',
11+
'Core/TerrainProvider',
12+
'Core/WebMercatorTilingScheme',
13+
'Specs/pollToPromise'
14+
], function(
15+
ArcGISTiledElevationTerrainProvider,
16+
DefaultProxy,
17+
GeographicTilingScheme,
18+
HeightmapTerrainData,
19+
CesiumMath,
20+
Request,
21+
RequestScheduler,
22+
Resource,
23+
RuntimeError,
24+
TerrainProvider,
25+
WebMercatorTilingScheme,
26+
pollToPromise) {
27+
'use strict';
28+
29+
describe('Core/ArcGISTiledElevationTerrainProvider', function() {
2830

2931
var lercTileUrl = 'Data/Images/Red16x16.png';
3032
var availability;
@@ -476,3 +478,4 @@ describe('requestTileGeometry', function() {
476478
});
477479
});
478480
});
481+
});

Specs/Core/AssociativeArraySpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
defineSuite([
1+
define([
22
'Core/AssociativeArray'
33
], function(
44
AssociativeArray) {
5-
'use strict';
5+
'use strict';
6+
7+
describe('Core/AssociativeArray', function() {
68

79
it('constructor has expected default values', function() {
810
var associativeArray = new AssociativeArray();
@@ -76,3 +78,4 @@ defineSuite([
7678
expect(associativeArray.remove(undefined)).toBe(false);
7779
});
7880
});
81+
});

Specs/Core/AttributeCompressionSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defineSuite([
1+
define([
22
'Core/AttributeCompression',
33
'Core/Cartesian2',
44
'Core/Cartesian3',
@@ -12,7 +12,9 @@ defineSuite([
1212
Cartesian4,
1313
defined,
1414
CesiumMath) {
15-
'use strict';
15+
'use strict';
16+
17+
describe('Core/AttributeCompression', function() {
1618

1719
var negativeUnitZ = new Cartesian3(0.0, 0.0, -1.0);
1820
it('oct decode(0, 0)', function() {
@@ -742,3 +744,4 @@ defineSuite([
742744
}).toThrowDeveloperError();
743745
});
744746
});
747+
});

Specs/Core/AxisAlignedBoundingBoxSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defineSuite([
1+
define([
22
'Core/AxisAlignedBoundingBox',
33
'Core/Cartesian3',
44
'Core/Intersect',
@@ -8,7 +8,9 @@ defineSuite([
88
Cartesian3,
99
Intersect,
1010
Plane) {
11-
'use strict';
11+
'use strict';
12+
13+
describe('Core/AxisAlignedBoundingBox', function() {
1214

1315
var positions = [
1416
new Cartesian3(3, -1, -3),
@@ -162,3 +164,4 @@ defineSuite([
162164
}).toThrowDeveloperError();
163165
});
164166
});
167+
});

Specs/Core/BingMapsApiSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
defineSuite([
1+
define([
22
'Core/BingMapsApi'
33
], function(
44
BingMapsApi) {
5-
'use strict';
5+
'use strict';
6+
7+
describe('Core/BingMapsApi', function() {
68

79
it('getKey returns provided key if one is provided', function() {
810
expect(BingMapsApi.getKey('foo')).toEqual('foo');
@@ -15,3 +17,4 @@ defineSuite([
1517
BingMapsApi.defaultKey = oldKey;
1618
});
1719
});
20+
});

Specs/Core/BingMapsGeocoderServiceSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
defineSuite([
1+
define([
22
'Core/BingMapsGeocoderService',
33
'Core/Rectangle',
44
'Core/Resource'
55
], function(
66
BingMapsGeocoderService,
77
Rectangle,
88
Resource) {
9-
'use strict';
9+
'use strict';
10+
11+
describe('Core/BingMapsGeocoderService', function() {
1012

1113
afterAll(function() {
1214
Resource._Implementations.loadAndExecuteScript = Resource._DefaultImplementations.loadAndExecuteScript;
@@ -66,3 +68,4 @@ defineSuite([
6668
});
6769
});
6870
});
71+
});

Specs/Core/BoundingRectangleSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defineSuite([
1+
define([
22
'Core/BoundingRectangle',
33
'Core/Cartesian2',
44
'Core/Ellipsoid',
@@ -14,7 +14,9 @@ defineSuite([
1414
Intersect,
1515
Rectangle,
1616
createPackableSpecs) {
17-
'use strict';
17+
'use strict';
18+
19+
describe('Core/BoundingRectangle', function() {
1820

1921
it('default constructor sets expected values', function() {
2022
var rectangle = new BoundingRectangle();
@@ -257,3 +259,4 @@ defineSuite([
257259

258260
createPackableSpecs(BoundingRectangle, new BoundingRectangle(1, 2, 3, 4), [1, 2, 3, 4]);
259261
});
262+
});

Specs/Core/BoundingSphereSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defineSuite([
1+
define([
22
'Core/BoundingSphere',
33
'Core/Cartesian3',
44
'Core/Cartographic',
@@ -28,7 +28,9 @@ defineSuite([
2828
Plane,
2929
Rectangle,
3030
createPackableSpecs) {
31-
'use strict';
31+
'use strict';
32+
33+
describe('Core/BoundingSphere', function() {
3234

3335
var positionsRadius = 1.0;
3436
var positionsCenter = new Cartesian3(10000001.0, 0.0, 0.0);
@@ -915,3 +917,4 @@ defineSuite([
915917

916918
createPackableSpecs(BoundingSphere, new BoundingSphere(new Cartesian3(1.0, 2.0, 3.0), 4.0), [1.0, 2.0, 3.0, 4.0]);
917919
});
920+
});

Specs/Core/BoxGeometrySpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defineSuite([
1+
define([
22
'Core/BoxGeometry',
33
'Core/arrayFill',
44
'Core/AxisAlignedBoundingBox',
@@ -14,7 +14,9 @@ defineSuite([
1414
GeometryOffsetAttribute,
1515
VertexFormat,
1616
createPackableSpecs) {
17-
'use strict';
17+
'use strict';
18+
19+
describe('Core/BoxGeometry', function() {
1820

1921
it('constructor throws without maximum corner', function() {
2022
expect(function() {
@@ -140,3 +142,4 @@ defineSuite([
140142
vertexFormat : VertexFormat.POSITION_AND_NORMAL
141143
}), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0]);
142144
});
145+
});

Specs/Core/BoxOutlineGeometrySpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defineSuite([
1+
define([
22
'Core/BoxOutlineGeometry',
33
'Core/arrayFill',
44
'Core/AxisAlignedBoundingBox',
@@ -12,7 +12,9 @@ defineSuite([
1212
Cartesian3,
1313
GeometryOffsetAttribute,
1414
createPackableSpecs) {
15-
'use strict';
15+
'use strict';
16+
17+
describe('Core/BoxOutlineGeometry', function() {
1618

1719
it('constructor throws without maximum corner', function() {
1820
expect(function() {
@@ -110,3 +112,4 @@ defineSuite([
110112
maximum : new Cartesian3(4.0, 5.0, 6.0)
111113
}), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, -1.0]);
112114
});
115+
});

0 commit comments

Comments
 (0)