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),
$store: {
state: {
creation: ["1000","1000","1000"],
creation: ['1000', '1000', '1000'],
},
},
}

View File

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

View File

@ -4,8 +4,23 @@ import Community from './Community'
const localVue = global.localVue
const mockStoreDispach = jest.fn()
const apolloQueryMock = 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', () => {
let wrapper
@ -14,10 +29,14 @@ describe('Community', () => {
$t: jest.fn((t) => t),
$d: jest.fn((d) => d),
$apollo: {
query: apolloQueryMock,
mutate: apolloMutationMock,
},
$store: {
dispatch: mockStoreDispach,
state: {
creation: ['1000', '1000', '1000'],
},
},
}

View File

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