Skip to content

Commit

Permalink
test: add tile overlay test
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Oct 14, 2020
1 parent eeb0035 commit b8ce414
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 11 deletions.
36 changes: 25 additions & 11 deletions test/unit/specs/module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,39 @@ describe('ti.map', () => {
}

if (ANDROID) {
describe('SERVICE_*', () => {
it('SERVICE_DISABLED', () => {
expect(Map.SERVICE_DISABLED).toEqual(jasmine.any(Number));
describe('TILE_OVERLAY_TYPE_*', () => {
it('TILE_OVERLAY_TYPE_WMS', () => {
expect(Map.TILE_OVERLAY_TYPE_WMS).toEqual(jasmine.any(Number));
});

it('SERVICE_INVALID', () => {
expect(Map.SERVICE_INVALID).toEqual(jasmine.any(Number));
it('TILE_OVERLAY_TYPE_WMTS', () => {
expect(Map.TILE_OVERLAY_TYPE_WMTS).toEqual(jasmine.any(Number));
});

it('SERVICE_MISSING', () => {
expect(Map.SERVICE_MISSING).toEqual(jasmine.any(Number));
it('TILE_OVERLAY_TYPE_BING', () => {
expect(Map.TILE_OVERLAY_TYPE_BING).toEqual(jasmine.any(Number));
});

it('SERVICE_VERSION_UPDATE_REQUIRED', () => {
expect(Map.SERVICE_VERSION_UPDATE_REQUIRED).toEqual(jasmine.any(Number));
it('TILE_OVERLAY_TYPE_CARTODB', () => {
expect(Map.TILE_OVERLAY_TYPE_CARTODB).toEqual(jasmine.any(Number));
});

it('SUCCESS', () => {
expect(Map.SUCCESS).toEqual(jasmine.any(Number));
it('TILE_OVERLAY_TYPE_XYZ', () => {
expect(Map.TILE_OVERLAY_TYPE_XYZ).toEqual(jasmine.any(Number));
});

it('TILE_OVERLAY_TYPE_OSM', () => {
expect(Map.TILE_OVERLAY_TYPE_OSM).toEqual(jasmine.any(Number));
});
});

describe('ANNOTATION_DRAG_STATE_*', () => {
it('ANNOTATION_DRAG_STATE_END', () => {
expect(Map.ANNOTATION_DRAG_STATE_END).toEqual(jasmine.any(Number));
});

it('ANNOTATION_DRAG_STATE_START', () => {
expect(Map.ANNOTATION_DRAG_STATE_START).toEqual(jasmine.any(Number));
});
});
}
Expand Down
35 changes: 35 additions & 0 deletions test/unit/specs/tileoverlay.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const Map = require('ti.map');
const ANDROID = (Ti.Platform.osname === 'android');

if (ANDROID) {
describe('ti.map', () => {
describe('#createTileOverlay()', () => {
it('is a Function', () => {
expect(Map.createTileOverlay).toEqual(jasmine.any(Function));
});
});
});

describe('ti.map.TileOverlay', () => {
let overlay;
beforeAll(() => {
overlay = Map.createTileOverlay({
service: Map.TILE_OVERLAY_TYPE_XYZ,
url: 'http://stamen-tiles-a.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png'
});
});

it('.apiName', () => {
expect(overlay.apiName).toEqual('Ti.Map.TileOverlay');
});

it('.service should match given constant', () => {
expect(overlay.service).toEqual(Map.TILE_OVERLAY_TYPE_XYZ);
});

it('.url should match given String', () => {
expect(overlay.url).toEqual('http://stamen-tiles-a.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png');
});

});
}
11 changes: 11 additions & 0 deletions test/unit/specs/view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ describe('ti.map.View', () => {
});
}

if (ANDROID) {
// TODO: Add to iOS for parity
it('#addTileOverlay() is a Function', () => {
expect(mapview.addTileOverlay).toEqual(jasmine.any(Function));
});

it('#removeTileOverlay() is a Function', () => {
expect(mapview.removeTileOverlay).toEqual(jasmine.any(Function));
});
}

it('#deselectAnnotation() is a Function', () => {
expect(mapview.deselectAnnotation).toEqual(jasmine.any(Function));
});
Expand Down

0 comments on commit b8ce414

Please sign in to comment.