db request test 2

This commit is contained in:
ogerly 2021-08-09 10:44:57 +02:00
parent 3e73a0ff4b
commit 355ec8618c
4 changed files with 22 additions and 64 deletions

View File

@ -144,13 +144,10 @@ export default {
// what to do when loading balance fails?
}
},
async updateGdt(pagination) {
const result2 = await communityAPI.transactionsgdt(
this.$store.state.sessionId
)
console.log(' communityAPI.transactionsgdt')
console.log(result2)
async updateGdt() {
// const result2 = await communityAPI.transactionsgdt(this.$store.state.sessionId)
// console.log(' communityAPI.transactionsgdt')
// console.log(result2)
this.transactionsGdt = [
{
@ -159,7 +156,7 @@ export default {
{
id: 8821,
amount: 1000,
date: '2020-08-12T14:12:00+00:00',
date: '2021-08-05T14:12:00+00:00',
email: 'foerderkreis-1@gradido.org',
comment: null,
coupon_code: '',
@ -172,7 +169,7 @@ export default {
{
id: 8810,
amount: 1500,
date: '2020-08-5T16:12:00+00:00',
date: '2021-08-04T16:12:00+00:00',
email: 'eopage-gradido-foerderpaket@gradido.org',
comment: null,
coupon_code: '',
@ -185,7 +182,7 @@ export default {
{
id: 8552,
amount: 1000,
date: '2020-06-17T14:12:00+00:00',
date: '2021-06-03T14:12:00+00:00',
email: 'foerderkreis-1@gradido.org',
comment: null,
coupon_code: '',
@ -198,7 +195,7 @@ export default {
{
id: 8317,
amount: 1000,
date: '2020-03-16T14:12:00+00:00',
date: '2021-03-16T14:12:00+00:00',
email: 'foerderkreis-1@gradido.org',
comment: null,
coupon_code: '',
@ -214,7 +211,7 @@ export default {
},
]
this.transactionGdtCount = this.transactionsGdt[0].count
// console.log('transactionGdtCount', this.transactionGdtCount)
// console.log('transactionGdtCount', this.transactionGdtCount)
},
updateBalance(ammount) {
this.balance -= ammount

View File

@ -1,8 +1,5 @@
<template>
<div class="gdt-transaction-list">
{{this.transactionsGdt[0].gdt}}
<b-list-group>
<b-list-group-item
v-for="{
@ -21,67 +18,30 @@
:key="id"
>
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{id}}: {{ email }}</h5>
<small>{{ date }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}</small>
<h5 class="mb-1">{{ id }}: {{ email }}</h5>
<small>{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}</small>
</div>
{{ gdt_entry_type_id === 7 ? 'GDT in Euro gekauft' : 'GDT von gradido bekommen' }}
<div v-if="gdt_entry_type_id === 7">
{{amount }} GDT {{ (amount / factor) }}
</div>
<div v-else>
{{amount }} GDT
</div>
{{ gdt_entry_type_id === 7 ? 'GDT in Euro gekauft' : 'GDT von gradido bekommen' }}
<div v-if="gdt_entry_type_id === 7">{{ amount }} GDT {{ amount / factor }}</div>
<div v-else>{{ amount }} GDT</div>
<small>
{{ id }} {{ amount }} {{ date }} {{ email }} {{ comment }} {{ coupon_code }}
{{ gdt_entry_type_id }} {{ factor }} {{ amount2 }} {{ factor2 }} {{ gdt }}
</small>
</b-list-group-item>
</b-list-group>
<!--
<hr>
<div>
{{transactionsGdt[0].state}}
</div>
<div>
{{transactionsGdt[0].gdt}}
</div>
<hr>
<div>
{{transactionsGdt[0]}}
</div>
-->
</div>
</template>
<script>
export default {
name: 'gdt-transaction-list',
props: {
transactionsGdt: { default: () => [] },
transactionGdtCount: { type: Number, default: 0 },
},
data() {
return {
gdt: []
}
},
methods: {
updateGdt() {
this.$emit('update-gdt', {
firstPage: this.currentPage,
items: this.pageSize,
})
},
},
}
</script>
<style>

View File

@ -1,4 +1,4 @@
import { mount } from '@vue/test-utils'
import { shallowMount } from '@vue/test-utils'
import UserProfileTransactionList from './UserProfileTransactionList'
const localVue = global.localVue
@ -8,10 +8,11 @@ describe('UserProfileTransactionList', () => {
const mocks = {
$t: jest.fn((t) => t),
$n: jest.fn((n) => String(n)),
}
const Wrapper = () => {
return mount(UserProfileTransactionList, { localVue, mocks })
return shallowMount(UserProfileTransactionList, { localVue, mocks })
}
describe('mount', () => {
@ -37,5 +38,9 @@ describe('UserProfileTransactionList', () => {
expect.arrayContaining([expect.arrayContaining([{ firstPage: 2, items: 25 }])]),
)
})
it('renders the transaction gradido transform table', () => {
expect(wrapper.findComponent({ name: 'GdtTransactionList' }).exists()).toBeTruthy()
})
})
})

View File

@ -19,7 +19,6 @@
<gdt-transaction-list
:transactionsGdt="transactionsGdt"
:transactionGdtCount="transactionGdtCount"
@update-gdt="updateGdt"
/>
</b-tab>
</b-tabs>
@ -56,9 +55,6 @@ export default {
updateTransactions(pagination) {
this.$emit('update-transactions', pagination)
},
updateGdt() {
this.$emit('update-gdt')
},
},
}
</script>