Skip to content

Commit

Permalink
test: Migrate route-importer.spec.js
Browse files Browse the repository at this point in the history
- the tested imports were exported with the client
  files from other sources should be tested as well
- remove old spec
  • Loading branch information
TheGreatRefrigerator committed Jan 26, 2023
1 parent 9ccfe7a commit 3d97c7d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 160 deletions.
62 changes: 62 additions & 0 deletions src/fragments/forms/route-importer/RouteImporter.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import RouteImporter from './RouteImporter.vue'
import I18nBuilder from '@/i18n/i18n-builder'
import store from '@/store/store'

describe('<RouteImporter />', () => {
it('renders', () => {
cy.mount(RouteImporter, {i18n: I18nBuilder.build(), store: store})
cy.get('.route-importer-container')
cy.get('.route-importer-btn button').click()
cy.get('.route-importer-modal')
cy.get('#dropzone')
})
context('file imports', () => {
beforeEach(() => {
cy.mount(RouteImporter, {i18n: I18nBuilder.build(), store: store})
cy.spy(RouteImporter.methods, 'fileAdded').as('fileAddedSpy')
cy.spy(RouteImporter.methods, 'sendDataToMap').as('sendDataToMapSpy')
cy.get('.route-importer-btn button').click()
})

afterEach(() => {
cy.get('.route-importer-modal').should('not.exist')
cy.get('@fileAddedSpy').should('have.been.calledOnce')
cy.get('@sendDataToMapSpy').should('have.been.calledOnce')
})

it('imports .geojson route file', () => {
cy.fixture('ors-route.geojson', {encoding: null}).as('geojsonRoute')
cy.get('#dropzone').selectFile('@geojsonRoute', {
action: 'drag-drop'
})
})

it('imports .json route file', () => {
cy.fixture('ors-route.json', {encoding: null}).as('jsonRoute')
cy.get('#dropzone').selectFile('@jsonRoute', {
action: 'drag-drop'
})
})

it('imports .gpx route file', () => {
cy.fixture('ors-route.gpx', {encoding: null}).as('gpxRoute')
cy.get('#dropzone').selectFile('@gpxRoute', {
action: 'drag-drop'
})
})

it('imports .kml route file', () => {
cy.fixture('ors-route.kml', {encoding: null}).as('kmlRoute')
cy.get('#dropzone').selectFile('@kmlRoute', {
action: 'drag-drop'
})
})

it('imports .txt route file file with valid xml', () => {
cy.fixture('ors-route.xml.txt', {encoding: null}).as('xmlTxtRoute')
cy.get('#dropzone').selectFile('@xmlTxtRoute', {
action: 'drag-drop'
})
})
})
})
160 changes: 0 additions & 160 deletions tests/integration/specs/route-importer.spec.js

This file was deleted.

0 comments on commit 3d97c7d

Please sign in to comment.