Skip to content

Commit

Permalink
test: Migrate app-render.spec.js
Browse files Browse the repository at this point in the history
- remove unused lines from map-view.js that conflict with test, as
  the translation returned is a string instead of an object
- contains code to be uncommented or adjusted after #324
  has been dealt with
- remove old spec
  • Loading branch information
TheGreatRefrigerator committed Jan 27, 2023
1 parent 67863e1 commit 3c842ed
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 66 deletions.
54 changes: 54 additions & 0 deletions src/App.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// // Solves the 'RegeneratorRuntime is not defined' issue according to
// // https://stackoverflow.com/questions/28976748/regeneratorruntime-is-not-defined
import '@babel/polyfill'

import AppLoader from '@/app-loader'
import store from '@/store/store'
import I18nBuilder from '@/i18n/i18n-builder'
import router from '@/router'
import AppRootComponent from '@/App.vue'
import Footer from '@/fragments/footer/Footer'
// TODO: implement global event bus as standalone module
// import EventBus from '@/common/event-bus'

describe('<App />', () => {
beforeEach(() => {
// // TODO: implement global event bus as standalone module
// cy.spy(EventBus, '$on').as('eventBusRegisterSpy')
// cy.spy(EventBus, '$emit').as('eventBusEmitSpy')
cy.intercept('GET', 'https://*.tile.openstreetmap.org/*/*/*.png', {fixture: 'map-pin.jpg'})
new AppLoader().fetchApiInitialData()
cy.stub(Footer.computed, 'appVersion', () => {
// appVersion reads from process.env, which isn't available in browser during testing
return 'X.X.X'
})
cy.mount(AppRootComponent, {i18n: I18nBuilder.build(), store: store, router: router})
})
it('renders the app component', () => {
cy.get('.app-content')
cy.get('#map-view')
cy.get('.simple-place-search')
cy.get('.progress-linear').should('have.class', 'progress-linear-disabled')
})

it.skip('should toggle progress bar correctly', () => {
// // TODO: implement global event bus as standalone module
// cy.get('@eventBusRegisterSpy').should('have.been.calledWith', 'showLoading')
// cy.get('@eventBusRegisterSpy').should('have.been.calledWith', 'titleChanged')
// cy.get('@eventBusRegisterSpy').should('have.been.calledWith', 'appLoaded')
// cy.get('@eventBusEmitSpy').should('have.been.calledWith', 'titleChanged')
//
// // check progress bar hidden after initial page load and set loading true
// cy.get('.progress-linear').should('have.class', 'progress-linear-disabled').then(() => {
// EventBus.$emit('showLoading', true)
// })
// cy.get('@eventBusEmitSpy').should('have.been.calledWith', 'showLoading', true)
//
// // check bar is enabled and set loading false again
// cy.get('.progress-linear').should('not.have.class', 'progress-linear-disabled').then(() => {
// EventBus.$emit('showLoading', false)
// })
// cy.get('@eventBusEmitSpy').should('have.been.calledWith', 'showLoading', false)
// cy.get('.progress-linear').should('have.class', 'progress-linear-disabled')
})
})
2 changes: 0 additions & 2 deletions src/fragments/map-view/map-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ export default {
polygons () {
const polygons = []
if (this.localMapViewData) {
const translations = this.$t('global.units')
translations.polygon = this.$t('global.polygon')
// We must not change the original object
const mapViewDataToBeTransformed = this.localMapViewData.clone()

Expand Down
64 changes: 0 additions & 64 deletions tests/integration/specs/app-render.spec.js

This file was deleted.

0 comments on commit 3c842ed

Please sign in to comment.