Skip to content

Commit

Permalink
Tested uncovered parts of the src/geo module (#4422)
Browse files Browse the repository at this point in the history
* Added test for untested transform#{set,get}fov

* Tested uncovered part of LngLatBounds

* Added missing semicolon
  • Loading branch information
joswinter authored and mourner committed Mar 15, 2017
1 parent d4e4f83 commit cbffd03
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/unit/geo/lng_lat_bounds.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,33 @@ test('LngLatBounds', (t) => {
t.end();
});

t.test('#extend with null', (t) => {
const bounds = new LngLatBounds([0, 0], [10, 10]);

bounds.extend(null);

t.equal(bounds.getSouth(), 0);
t.equal(bounds.getWest(), 0);
t.equal(bounds.getNorth(), 10);
t.equal(bounds.getEast(), 10);

t.end();
});

t.test('#extend undefined bounding box', (t) => {
const bounds1 = new LngLatBounds(undefined, undefined);
const bounds2 = new LngLatBounds([-10, -10], [10, 10]);

bounds1.extend(bounds2);

t.equal(bounds1.getSouth(), -10);
t.equal(bounds1.getWest(), -10);
t.equal(bounds1.getNorth(), 10);
t.equal(bounds1.getEast(), 10);

t.end();
});

t.test('accessors', (t) => {
const sw = new LngLat(0, 0);
const ne = new LngLat(-10, -20);
Expand Down
9 changes: 9 additions & 0 deletions test/unit/geo/transform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ test('transform', (t) => {
t.end();
});

t.test('set fov', (t) => {
const transform = new Transform();
transform.fov = 10;
t.equal(transform.fov, 10);
transform.fov = 10;
t.equal(transform.fov, 10);
t.end();
});

t.test('lngRange & latRange constrain zoom and center', (t) => {
const transform = new Transform();
transform.center = new LngLat(0, 0);
Expand Down

0 comments on commit cbffd03

Please sign in to comment.