mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test for adminarea fix coverage
This commit is contained in:
parent
d4ea39ce03
commit
005ff89e20
@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -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 = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user