fix test, linting

This commit is contained in:
Moriz Wahl 2021-08-10 15:42:30 +02:00
parent 281a6beadd
commit ad12dd46f4
3 changed files with 25 additions and 17 deletions

View File

@ -144,14 +144,14 @@ export default {
} }
}, },
async updateGdt() { async updateGdt() {
const result2 = await communityAPI.transactionsgdt(this.$store.state.sessionId) const result2 = await communityAPI.transactionsgdt(this.$store.state.sessionId)
console.log(' communityAPI.transactionsgdt') // console.log(' communityAPI.transactionsgdt')
console.log(result2.result) // console.log(result2.result)
console.log(result2.result.data.gdtEntries) // console.log(result2.result.data.gdtEntries)
this.GdtBalance = Number(result2.result.data.gdtSum) this.GdtBalance = Number(result2.result.data.gdtSum)
this.transactionsGdt = result2.result.data.gdtEntries this.transactionsGdt = result2.result.data.gdtEntries
this.transactionGdtCount = result2.result.data.count this.transactionGdtCount = result2.result.data.count
/* /*
this.transactionsGdt = this.transactionsGdt =
{ {
state: 'success', state: 'success',
@ -213,7 +213,7 @@ export default {
count: 4, count: 4,
} }
*/ */
//this.transactionGdtCount = this.transactionsGdt.count // this.transactionGdtCount = this.transactionsGdt.count
// console.log('transactionGdtCount', this.transactionGdtCount) // console.log('transactionGdtCount', this.transactionGdtCount)
}, },
updateBalance(ammount) { updateBalance(ammount) {

View File

@ -18,14 +18,12 @@
:key="id" :key="id"
> >
<div class="d-flex w-100 justify-content-between"> <div class="d-flex w-100 justify-content-between">
<h5 class="mb-1"> Gradido Transform (GDT) erhalten {{ comment ? ': '+comment : '' }}</h5> <h5 class="mb-1">Gradido Transform (GDT) erhalten {{ comment ? ': ' + comment : '' }}</h5>
<small>{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}</small> <small>{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}</small>
</div> </div>
<div v-if="gdt_entry_type_id === 7">{{ amount }} GDT * {{ factor }} = {{ gdt }}</div>
<div v-else>{{ amount }} {{ gdt }} GDT</div>
<div v-if="gdt_entry_type_id === 7">{{ amount }} GDT * {{factor}} = {{gdt}}</div>
<div v-else>{{ amount }} {{ gdt}} GDT</div>
<small> <small>
{{ id }} {{ amount }} {{ date }} {{ email }} {{ comment }} {{ coupon_code }} {{ id }} {{ amount }} {{ date }} {{ email }} {{ comment }} {{ coupon_code }}
{{ gdt_entry_type_id }} {{ factor }} {{ amount2 }} {{ factor2 }} {{ gdt }} {{ gdt_entry_type_id }} {{ factor }} {{ amount2 }} {{ factor2 }} {{ gdt }}

View File

@ -1,8 +1,18 @@
import { shallowMount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import UserProfileTransactionList from './UserProfileTransactionList' import UserProfileTransactionList from './UserProfileTransactionList'
const localVue = global.localVue const localVue = global.localVue
const mutationObserverMock = jest.fn(function MutationObserver(callback) {
this.observe = jest.fn()
this.disconnect = jest.fn()
this.trigger = (mockedMutationsList) => {
callback(mockedMutationsList, this)
}
})
global.MutationObserver = mutationObserverMock
describe('UserProfileTransactionList', () => { describe('UserProfileTransactionList', () => {
let wrapper let wrapper
@ -12,7 +22,7 @@ describe('UserProfileTransactionList', () => {
} }
const Wrapper = () => { const Wrapper = () => {
return shallowMount(UserProfileTransactionList, { localVue, mocks }) return mount(UserProfileTransactionList, { localVue, mocks })
} }
describe('mount', () => { describe('mount', () => {
@ -25,7 +35,7 @@ describe('UserProfileTransactionList', () => {
}) })
it('emits update-transactions after creation', () => { it('emits update-transactions after creation', () => {
expect(wrapper.emitted('update-transactions')).toEqual( expect(wrapper.emitted('update-transactions')).toEqual(
expect.arrayContaining([expect.arrayContaining([{ firstPage: 1, items: 25 }])]), expect.arrayContaining([expect.arrayContaining([{ firstPage: 1, items: 25 }])]),
) )
}) })