Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Add basic tests for the layersHerald
Browse files Browse the repository at this point in the history
  • Loading branch information
samuellapointe committed Jul 15, 2016
1 parent cac8ad8 commit bbcf546
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/src/herald/layersherald.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
goog.provide('olgm.test.herald.Layers');

describe('olgm.herald.Layers', function() {
// Setup constructor variables
var originalOl3map = new ol.Map({});
var gmapEl = document.createElement('div');
gmapEl.style.height = '100px';
gmapEl.style.width = '100px';
var originalGmap = new google.maps.Map(gmapEl);
var watchVector = true;

describe('constructor', function() {
var layersHerald = new olgm.herald.Layers(
originalOl3map, originalGmap, watchVector);

it('sets the Google Maps map', function() {
var gmap = layersHerald.gmap;
expect(gmap).to.be.an.instanceof(google.maps.Map);
expect(gmap).to.equal(originalGmap);
});

it('sets the OpenLayers map', function() {
var ol3map = layersHerald.ol3map;
expect(ol3map).to.be.an.instanceof(ol.Map);
expect(ol3map).to.equal(originalOl3map);
});
});

describe('#activate()', function() {
it('adds listener keys for layers added and removed', function() {
var layersHerald = new olgm.herald.Layers(
originalOl3map, originalGmap, watchVector);
var listenerKeys = layersHerald.listenerKeys;
var expectedNbListenerKeys = listenerKeys.length + 2;

layersHerald.activate();

expect(listenerKeys.length).to.equal(expectedNbListenerKeys);
});
});
});

0 comments on commit bbcf546

Please sign in to comment.