Skip to content

Commit

Permalink
test: Migrate muild-map-data.spec.js
Browse files Browse the repository at this point in the history
- needs to be run as a component test, as it needs the App context
  including the store. It is therefore not in the __tests__ folder but on
  the same level as the script.
- added empty, skipped test bodies for missing functions
- issue #323
  there are currently 2 similar and confusing functions:
  - buildMapViewData: 'Build and returns map data'
  - buildMapData: 'Build the mapViewData object'
- remove old spec
  • Loading branch information
TheGreatRefrigerator committed Jan 26, 2023
1 parent e70d02f commit 3e5161b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 49 deletions.
54 changes: 54 additions & 0 deletions src/support/map-data-services/map-view-data-builder.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import buildMapData from 'fixtures/build-map-data'
import MapViewDataBuilder from './map-view-data-builder'
import MapViewData from '@/models/map-view-data'


describe('MapViewData building', () => {
context('buildMapViewData()', () => {
it('builds with directions map data', () => {
return new Promise((resolve, reject) => {
MapViewDataBuilder.buildMapData(buildMapData.directionsMapData, []).then(
response => {
assert.isDefined(response)
expect(response).to.be.instanceOf(MapViewData)
expect(response.routes).to.have.length(1)
expect(response.places).to.have.length(2)
expect(response.mode).to.equal('directions')
resolve()
}).catch(error => {
reject(error)
})
})
})
it('builds with isochrones map data', () => {
return new Promise((resolve, reject) => {
MapViewDataBuilder.buildMapData(buildMapData.isochronesMapData, []).then(
response => {
assert.isDefined(response)
expect(response).to.be.instanceOf(MapViewData)
expect(response.polygons).to.have.length(1)
expect(response.places).to.have.length(1)
expect(response.mode).to.equal('isochrones')
resolve()
}).catch(error => {
reject(error)
})
})
})
})
context.skip('getSourceType()', () => {
it.skip('gets the source type', () => {
// TODO
})
})
context.skip('setMapExtractorBuilder()', () => {
it.skip('sets the map data builder', () => {
// TODO
})
})
context.skip('buildMapData()', () => {
it.skip('builds the map data', () => {
// TODO
})
})
})
49 changes: 0 additions & 49 deletions tests/integration/specs/muild-map-data.spec.js

This file was deleted.

0 comments on commit 3e5161b

Please sign in to comment.