change tests

This commit is contained in:
ogerly 2022-08-31 11:37:48 +02:00
parent 2a4c61fca0
commit 1f0bea76c5
9 changed files with 48 additions and 12 deletions

View File

@ -40,7 +40,7 @@ describe('ContributionMessagesFormular', () => {
expect(wrapper.find('div.contribution-messages-formular').exists()).toBe(true)
})
describe('call onReset', () => {
describe('on trigger reset', () => {
beforeEach(async () => {
wrapper.setData({
form: {
@ -50,17 +50,34 @@ describe('ContributionMessagesFormular', () => {
await wrapper.find('form').trigger('reset')
})
it('form has the set data', () => {
it('form has empty text', () => {
expect(wrapper.vm.form).toEqual({
text: '',
})
})
})
describe('call onSubmit', () => {
it('response with the contribution message', async () => {
describe('on trigger submit', () => {
beforeEach(async () => {
wrapper.setData({
form: {
text: 'text form message',
},
})
await wrapper.find('form').trigger('submit')
})
it('emitted "get-list-contribution-messages" with data', async () => {
expect(wrapper.emitted('get-list-contribution-messages')).toEqual(
expect.arrayContaining([expect.arrayContaining([42])]),
)
})
it('emitted "update-state" with data', async () => {
expect(wrapper.emitted('update-state')).toEqual(
expect.arrayContaining([expect.arrayContaining([42])]),
)
})
})
describe('send contribution message with error', () => {

View File

@ -8,6 +8,7 @@ describe('ContributionMessagesListItem', () => {
const mocks = {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
$store: {
state: {
moderator: {

View File

@ -8,6 +8,7 @@ describe('IsModerator', () => {
const mocks = {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
}
const propsData = {

View File

@ -8,6 +8,7 @@ describe('IsNotModerator', () => {
const mocks = {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
}
const propsData = {

View File

@ -40,7 +40,7 @@ describe('ContributionMessagesFormular', () => {
expect(wrapper.find('div.contribution-messages-formular').exists()).toBe(true)
})
describe('call onReset', () => {
describe('on trigger reset', () => {
beforeEach(async () => {
wrapper.setData({
form: {
@ -50,17 +50,34 @@ describe('ContributionMessagesFormular', () => {
await wrapper.find('form').trigger('reset')
})
it('form has the set data', () => {
it('form has empty text', () => {
expect(wrapper.vm.form).toEqual({
text: '',
})
})
})
describe('call onSubmit', () => {
it('response with the contribution message', async () => {
describe('on trigger submit', () => {
beforeEach(async () => {
wrapper.setData({
form: {
text: 'text form message',
},
})
await wrapper.find('form').trigger('submit')
})
it('emitted "get-list-contribution-messages" with data', async () => {
expect(wrapper.emitted('get-list-contribution-messages')).toEqual(
expect.arrayContaining([expect.arrayContaining([42])]),
)
})
it('emitted "update-state" with data', async () => {
expect(wrapper.emitted('update-state')).toEqual(
expect.arrayContaining([expect.arrayContaining([42])]),
)
})
})
describe('send contribution message with error', () => {

View File

@ -8,6 +8,7 @@ describe('ContributionMessagesList', () => {
const mocks = {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
$store: {
state: {
firstName: 'Peter',

View File

@ -8,6 +8,7 @@ describe('IsModerator', () => {
const mocks = {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
}
const propsData = {

View File

@ -8,6 +8,7 @@ describe('IsNotModerator', () => {
const mocks = {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
}
const propsData = {

View File

@ -92,10 +92,6 @@ describe('Community', () => {
it('has three tabs', () => {
expect(wrapper.findAll('div[role="tabpanel"]')).toHaveLength(3)
})
it('has first tab active by default', () => {
expect(wrapper.findAll('div[role="tabpanel"]').at(0).classes('active')).toBe(true)
})
})
describe('API calls after creation', () => {