Fix frontend tests

I also removed one frontend test. The test case was checking an edge
case. We use `hasMore` as the single source of truth so I think it's
safe to remove this test case.
This commit is contained in:
roschaefer 2019-11-15 15:45:05 +01:00
parent 3fa7eeb038
commit 950df1cd07
2 changed files with 2 additions and 19 deletions

View File

@ -18,6 +18,7 @@ localVue.use(InfiniteLoading)
config.stubs['client-only'] = '<span><slot /></span>' config.stubs['client-only'] = '<span><slot /></span>'
config.stubs['router-link'] = '<span><slot /></span>' config.stubs['router-link'] = '<span><slot /></span>'
config.stubs['nuxt-link'] = '<span><slot /></span>' config.stubs['nuxt-link'] = '<span><slot /></span>'
config.stubs['infinite-loading'] = '<span><slot /></span>'
describe('PostIndex', () => { describe('PostIndex', () => {
let wrapper let wrapper
@ -29,7 +30,6 @@ describe('PostIndex', () => {
beforeEach(() => { beforeEach(() => {
mutations = { mutations = {
'posts/SELECT_ORDER': jest.fn(), 'posts/SELECT_ORDER': jest.fn(),
'posts/SET_CURRENT_POSTS': jest.fn(),
} }
store = new Vuex.Store({ store = new Vuex.Store({
getters: { getters: {
@ -54,7 +54,6 @@ describe('PostIndex', () => {
'auth/user': () => { 'auth/user': () => {
return { id: 'u23' } return { id: 'u23' }
}, },
'posts/currentPosts': () => [],
}, },
mutations, mutations,
}) })

View File

@ -16,6 +16,7 @@ localVue.filter('date', d => d)
config.stubs['client-only'] = '<span><slot /></span>' config.stubs['client-only'] = '<span><slot /></span>'
config.stubs['v-popover'] = '<span><slot /></span>' config.stubs['v-popover'] = '<span><slot /></span>'
config.stubs['nuxt-link'] = '<span><slot /></span>' config.stubs['nuxt-link'] = '<span><slot /></span>'
config.stubs['infinite-loading'] = '<span><slot /></span>'
describe('ProfileSlug', () => { describe('ProfileSlug', () => {
let wrapper let wrapper
@ -127,23 +128,6 @@ describe('ProfileSlug', () => {
}) })
}) })
describe('pagination returned less posts than available', () => {
beforeEach(() => {
const posts = [1, 2, 3, 4, 5].map(id => {
return {
...aPost,
id,
}
})
wrapper.setData({ posts, hasMore: true })
})
it('does not display a "load more" button', () => {
expect(wrapper.find('.load-more').exists()).toBe(false)
})
})
describe('pagination returned at least as many posts as pageSize', () => { describe('pagination returned at least as many posts as pageSize', () => {
beforeEach(() => { beforeEach(() => {
const posts = [1, 2, 3, 4, 5, 6].map(id => { const posts = [1, 2, 3, 4, 5, 6].map(id => {