test for adminarea fix coverage

This commit is contained in:
ogerly 2022-08-30 08:57:59 +02:00
parent d4ea39ce03
commit 005ff89e20
2 changed files with 58 additions and 24 deletions

View File

@ -0,0 +1,57 @@
import { mount } from '@vue/test-utils'
import ContributionMessagesList from './ContributionMessagesList.vue'
import { toastErrorSpy, toastSuccessSpy } from '../../../test/testSetup'
const localVue = global.localVue
const apolloQueryMock = jest.fn().mockResolvedValue()
describe('ContributionMessagesList', () => {
let wrapper
const propsData = {
contributionId: 42,
}
const mocks = {
$t: jest.fn((t) => t),
$i18n: {
locale: 'en',
},
$apollo: {
query: apolloQueryMock,
},
}
const Wrapper = () => {
return mount(ContributionMessagesList, {
localVue,
mocks,
propsData,
})
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('sends query to Apollo when created', () => {
expect(apolloQueryMock).toBeCalledWith(
expect.objectContaining({
variables: {
contributionId: propsData.contributionId,
},
}),
)
})
it('has a DIV .contribution-messages-list', () => {
expect(wrapper.find('div.contribution-messages-list').exists()).toBe(true)
})
it('has a Component ContributionMessagesFormular', () => {
expect(wrapper.findComponent({ name: 'ContributionMessagesFormular' }).exists()).toBe(true)
})
})
})

View File

@ -9,30 +9,7 @@ describe('ContributionMessagesList', () => {
const propsData = {
contributionId: 42,
state: 'IN_PROGRESS',
messages: [
// {
// id: 111,
// message: 'asd asda sda sda',
// createdAt: '2022-08-29T12:23:27.000Z',
// updatedAt: null,
// type: 'DIALOG',
// userFirstName: 'Peter',
// userLastName: 'Lustig',
// userId: 107,
// __typename: 'ContributionMessage',
// },
// {
// id: 113,
// message: 'asda sdad ad asdasd ',
// createdAt: '2022-08-29T12:25:34.000Z',
// updatedAt: null,
// type: 'DIALOG',
// userFirstName: 'Bibi',
// userLastName: 'Bloxberg',
// userId: 108,
// __typename: 'ContributionMessage',
// },
],
messages: [],
}
const mocks = {