mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
rename footer to content-footer and simple test App.vue
This commit is contained in:
parent
e856c326eb
commit
5c73c9ae69
@ -1,43 +1,20 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import App from './App'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const storeCommitMock = jest.fn()
|
||||
|
||||
const mocks = {
|
||||
$store: {
|
||||
commit: storeCommitMock,
|
||||
},
|
||||
const stubs = {
|
||||
RouterView: true,
|
||||
}
|
||||
|
||||
const localStorageMock = (() => {
|
||||
let store = {}
|
||||
|
||||
return {
|
||||
getItem: (key) => {
|
||||
return store[key] || null
|
||||
},
|
||||
setItem: (key, value) => {
|
||||
store[key] = value.toString()
|
||||
},
|
||||
removeItem: (key) => {
|
||||
delete store[key]
|
||||
},
|
||||
clear: () => {
|
||||
store = {}
|
||||
},
|
||||
}
|
||||
})()
|
||||
|
||||
describe('App', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(App, { localVue, mocks })
|
||||
return shallowMount(App, { localVue, stubs })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
describe('shallowMount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
@ -46,23 +23,4 @@ describe('App', () => {
|
||||
expect(wrapper.find('div#app').exists()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('window localStorage is undefined', () => {
|
||||
it('does not commit a token to the store', () => {
|
||||
expect(storeCommitMock).not.toBeCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('with token in local storage', () => {
|
||||
beforeEach(() => {
|
||||
Object.defineProperty(window, 'localStorage', {
|
||||
value: localStorageMock,
|
||||
})
|
||||
window.localStorage.setItem('vuex', JSON.stringify({ token: 1234 }))
|
||||
})
|
||||
|
||||
it.skip('commits the token to the store', () => {
|
||||
expect(storeCommitMock).toBeCalledWith('token', 1234)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -2,18 +2,18 @@
|
||||
<div id="app">
|
||||
<nav-bar class="wrapper-nav" />
|
||||
<router-view class="wrapper p-3"></router-view>
|
||||
<foo-ter />
|
||||
<content-footer />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import FooTer from '@/components/Footer.vue'
|
||||
import ContentFooter from '@/components/ContentFooter.vue'
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
NavBar,
|
||||
FooTer,
|
||||
ContentFooter,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -8,3 +8,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ContentFooter',
|
||||
}
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user