Skip to content

Commit

Permalink
Add tests for osm landfill layer and unearthing layer
Browse files Browse the repository at this point in the history
  • Loading branch information
crisner committed Mar 4, 2020
1 parent 2191c33 commit 412809b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cypress/integration/osmLandfill.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
describe('OSM Landfill, Mines and Quarries layer', function() {
it('adds markers on click', function() {
cy.openWindow('/example/index.html#lat=42.7029&lon=-99.1509&zoom=11&layers=Standard')
cy.wait(300)
cy.window().then((win) => {
const stub = cy.stub(win.OSMLandfillMineQuarryLayer, 'requestData')
cy.get('#menu-osmLandfillMineQuarryLayer label').click({ force: true }).then(() => {
expect(stub).to.be.called
})
})
})

it('should have the layer name added to the hash', function() {
cy.hash().should('eq', '#lat=42.7029&lon=-99.1509&zoom=11&layers=Standard,osmLandfillMineQuarryLayer')
})

it('removes layer name from the hash when clicked again', function() {
cy.get('#menu-osmLandfillMineQuarryLayer label').click({ force: true })
cy.hash().should('eq', '#lat=42.7029&lon=-99.1509&zoom=11&layers=Standard')
})
})
21 changes: 21 additions & 0 deletions cypress/integration/unearthing.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
describe('Unearthing layer', function() {
it('adds markers on click', function() {
cy.openWindow('/example/index.html#lat=51.15&lon=13.45&zoom=4&layers=Standard')
cy.wait(300)
cy.window().then((win) => {
const stub = cy.stub(win.Unearthing, 'requestData')
cy.get('#menu-Unearthing label').click({ force: true }).then(() => {
expect(stub).to.be.called
})
})
})

it('should have the layer name added to the hash', function() {
cy.hash().should('eq', '#lat=51.15&lon=13.45&zoom=4&layers=Standard,Unearthing')
})

it('removes layer name from the hash when clicked again', function() {
cy.get('#menu-Unearthing label').click({ force: true })
cy.hash().should('eq', '#lat=51.15&lon=13.45&zoom=4&layers=Standard')
})
})

0 comments on commit 412809b

Please sign in to comment.