fix tests

This commit is contained in:
Moriz Wahl 2022-07-15 11:01:36 +02:00
parent c170c48ac4
commit 9efb83b2af
4 changed files with 30 additions and 11 deletions

View File

@ -11,7 +11,7 @@ describe('ContributionForm', () => {
$d: jest.fn((d) => d), $d: jest.fn((d) => d),
$store: { $store: {
state: { state: {
creation: ["1000","1000","1000"], creation: ['1000', '1000', '1000'],
}, },
}, },
} }

View File

@ -57,23 +57,23 @@ export default {
}, },
computed: { computed: {
type() { type() {
if (this.deletedAt !== null) return 'deleted' if (this.deletedAt) return 'deleted'
if (this.confirmedAt !== null) return 'confirmed' if (this.confirmedAt) return 'confirmed'
return 'pending' return 'pending'
}, },
icon() { icon() {
if (this.deletedAt !== null) return 'x-circle' if (this.deletedAt) return 'x-circle'
if (this.confirmedAt !== null) return 'check' if (this.confirmedAt) return 'check'
return 'bell-fill' return 'bell-fill'
}, },
variant() { variant() {
if (this.deletedAt !== null) return 'danger' if (this.deletedAt) return 'danger'
if (this.confirmedAt !== null) return 'success' if (this.confirmedAt) return 'success'
return 'primary' return 'primary'
}, },
date() { date() {
if (this.deletedAt !== null) return this.deletedAt if (this.deletedAt) return this.deletedAt
if (this.confirmedAt !== null) return this.confirmedAt if (this.confirmedAt) return this.confirmedAt
return this.createdAt return this.createdAt
}, },
}, },

View File

@ -4,8 +4,23 @@ import Community from './Community'
const localVue = global.localVue const localVue = global.localVue
const mockStoreDispach = jest.fn() const mockStoreDispach = jest.fn()
const apolloQueryMock = jest.fn()
const apolloMutationMock = jest.fn() const apolloMutationMock = jest.fn()
apolloMutationMock.mockResolvedValue('success') apolloQueryMock.mockResolvedValue({
data: {
listContributions: [
{
id: 1555,
amount: '200',
memo: 'Fleisig, fleisig am Arbeiten mein Lieber Freund, 50 Zeichen sind viel',
createdAt: '2022-07-15T08:47:06.000Z',
deletedAt: null,
confirmedBy: null,
confirmedAt: null,
},
],
},
})
describe('Community', () => { describe('Community', () => {
let wrapper let wrapper
@ -14,10 +29,14 @@ describe('Community', () => {
$t: jest.fn((t) => t), $t: jest.fn((t) => t),
$d: jest.fn((d) => d), $d: jest.fn((d) => d),
$apollo: { $apollo: {
query: apolloQueryMock,
mutate: apolloMutationMock, mutate: apolloMutationMock,
}, },
$store: { $store: {
dispatch: mockStoreDispach, dispatch: mockStoreDispach,
state: {
creation: ['1000', '1000', '1000'],
},
}, },
} }

View File

@ -73,7 +73,7 @@ export default {
this.toastError(err.message) this.toastError(err.message)
}) })
}, },
async updateListContributions(pagination) { updateListContributions(pagination) {
this.$apollo this.$apollo
.query({ .query({
fetchPolicy: 'no-cache', fetchPolicy: 'no-cache',