change for tests

This commit is contained in:
ogerly 2022-07-15 10:11:07 +02:00
parent 6ce1fb2082
commit c170c48ac4
5 changed files with 29 additions and 16 deletions

View File

@ -8,6 +8,12 @@ describe('ContributionForm', () => {
const mocks = { const mocks = {
$t: jest.fn((t) => t), $t: jest.fn((t) => t),
$d: jest.fn((d) => d),
$store: {
state: {
creation: ["1000","1000","1000"],
},
},
} }
const Wrapper = () => { const Wrapper = () => {

View File

@ -8,31 +8,32 @@ describe('ContributionList', () => {
const mocks = { const mocks = {
$t: jest.fn((t) => t), $t: jest.fn((t) => t),
$d: jest.fn((d) => d),
} }
const propsData = { const propsData = {
contributionCount: 3,
showPagination: true,
pageSize: 25,
items: [ items: [
{ {
id: '0', id: 0,
date: '07/06/2022', date: '07/06/2022',
memo: 'Ich habe 10 Stunden die Elbwiesen von Müll befreit.', memo: 'Ich habe 10 Stunden die Elbwiesen von Müll befreit.',
amount: 200, amount: '200',
status: 'pending',
}, },
{ {
id: '1', id: 1,
date: '06/22/2022', date: '06/22/2022',
memo: 'Ich habe 30 Stunden Frau Müller beim EInkaufen und im Haushalt geholfen.', memo: 'Ich habe 30 Stunden Frau Müller beim EInkaufen und im Haushalt geholfen.',
amount: 600, amount: '600',
status: 'pending',
}, },
{ {
id: '2', id: 2,
date: '05/04/2022', date: '05/04/2022',
memo: memo:
'Ich habe 50 Stunden den Nachbarkindern bei ihren Hausaufgaben geholfen und Nachhilfeunterricht gegeben.', 'Ich habe 50 Stunden den Nachbarkindern bei ihren Hausaufgaben geholfen und Nachhilfeunterricht gegeben.',
amount: 1000, amount: '1000',
status: 'pending',
}, },
], ],
} }

View File

@ -47,11 +47,11 @@ describe('Sidebar', () => {
it('has first nav-item "navigation.transactions" in navbar', () => { it('has first nav-item "navigation.transactions" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('navigation.transactions') expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('navigation.transactions')
}) })
it('has first nav-item "navigation.profile" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('navigation.profile')
})
it('has a link to the community area', () => { it('has a link to the community area', () => {
expect(wrapper.findAll('.nav-item').at(4).text()).toContain('navigation.community') expect(wrapper.findAll('.nav-item').at(3).text()).toContain('navigation.community')
})
it('has first nav-item "navigation.profile" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile')
}) })
it('has a link to the members area', () => { it('has a link to the members area', () => {
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.members_area') expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.members_area')

View File

@ -1,11 +1,9 @@
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import Community from './Community' import Community from './Community'
// import { createContribution } from '@/graphql/mutations'
// import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue const localVue = global.localVue
const mockStoreDispach = jest.fn()
const apolloMutationMock = jest.fn() const apolloMutationMock = jest.fn()
apolloMutationMock.mockResolvedValue('success') apolloMutationMock.mockResolvedValue('success')
@ -14,9 +12,13 @@ describe('Community', () => {
const mocks = { const mocks = {
$t: jest.fn((t) => t), $t: jest.fn((t) => t),
$d: jest.fn((d) => d),
$apollo: { $apollo: {
mutate: apolloMutationMock, mutate: apolloMutationMock,
}, },
$store: {
dispatch: mockStoreDispach,
},
} }
const Wrapper = () => { const Wrapper = () => {

View File

@ -118,12 +118,16 @@ export default {
this.form.memo = item.memo this.form.memo = item.memo
this.form.amount = item.amount this.form.amount = item.amount
}, },
updateTransactions(pagination) {
this.$emit('update-transactions', pagination)
},
}, },
created() { created() {
this.updateListContributions({ this.updateListContributions({
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
}) })
this.updateTransactions(0)
}, },
} }
</script> </script>