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'
|
import App from './App'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
const storeCommitMock = jest.fn()
|
const stubs = {
|
||||||
|
RouterView: true,
|
||||||
const mocks = {
|
|
||||||
$store: {
|
|
||||||
commit: storeCommitMock,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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', () => {
|
describe('App', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(App, { localVue, mocks })
|
return shallowMount(App, { localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('shallowMount', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
@ -46,23 +23,4 @@ describe('App', () => {
|
|||||||
expect(wrapper.find('div#app').exists()).toBeTruthy()
|
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">
|
<div id="app">
|
||||||
<nav-bar class="wrapper-nav" />
|
<nav-bar class="wrapper-nav" />
|
||||||
<router-view class="wrapper p-3"></router-view>
|
<router-view class="wrapper p-3"></router-view>
|
||||||
<foo-ter />
|
<content-footer />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
import FooTer from '@/components/Footer.vue'
|
import ContentFooter from '@/components/ContentFooter.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
NavBar,
|
NavBar,
|
||||||
FooTer,
|
ContentFooter,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -8,3 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'ContentFooter',
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
x
Reference in New Issue
Block a user