This commit is contained in:
ogerly 2021-09-08 12:19:19 +02:00
parent 69a6566c4b
commit 95e937f6e1
4 changed files with 24 additions and 37 deletions

View File

@ -20,8 +20,17 @@ describe('Transaction', () => {
},
}
const propsData = {
amount: 100,
gdt: 110,
factor: 22,
comment: '',
date: '2020-04-10T13:28:00+00:00',
gdtEntryType: 4,
}
const Wrapper = () => {
return mount(Transaction, { localVue, mocks })
return mount(Transaction, { localVue, mocks, propsData })
}
describe('mount', () => {

View File

@ -60,29 +60,27 @@
<!-- collaps trancaction info-->
<b-collapse :id="'a' + date + ''" class="pb-4">
<transaction-collaps
<transaction-collapse
:amount="amount"
:gdtEntryType="gdtEntryType"
:factor="factor"
:gdt="gdt"
></transaction-collaps>
></transaction-collapse>
</b-collapse>
</div>
</div>
</template>
<script>
import TransactionCollaps from '../components/TransactionCollaps.vue'
import TransactionCollapse from './TransactionCollapse.vue'
export default {
name: 'Transaction',
components: {
TransactionCollaps,
TransactionCollapse,
},
props: {
amount: { type: Number },
date: {
type: Date,
},
date: { type: String },
comment: { type: String },
gdtEntryType: { type: Number, default: 1 },
factor: { type: Number },
@ -116,18 +114,8 @@ export default {
const type = linesByType[givenType]
if (type)
return {
icon: type.icon,
iconclasses: type.iconclasses,
description: type.description,
descriptiontext: type.descriptiontext,
credittext: type.credittext,
}
this.throwError('no lines for this type')
},
throwError(msg) {
throw new Error(msg)
if (type) return type
throw new Error('no lines for this type')
},
},
}

View File

@ -1,11 +1,11 @@
import { mount } from '@vue/test-utils'
import TransactionCollaps from './TransactionCollaps'
import TransactionCollapse from './TransactionCollapse'
const localVue = global.localVue
const toastErrorMock = jest.fn()
describe('TransactionCollaps', () => {
describe('TransactionCollapse', () => {
let wrapper
const mocks = {
@ -21,7 +21,7 @@ describe('TransactionCollaps', () => {
}
const Wrapper = () => {
return mount(TransactionCollaps, { localVue, mocks })
return mount(TransactionCollapse, { localVue, mocks })
}
describe('mount', () => {

View File

@ -21,10 +21,10 @@
</template>
<script>
export default {
name: 'transaction-collaps',
name: 'TransactionCollapse',
props: {
amount: { type: Number },
gdtEntryType: { type: Number },
gdtEntryType: { type: Number, default: 1 },
factor: { type: Number },
gdt: { type: Number },
},
@ -68,18 +68,8 @@ export default {
const type = linesByType[givenType]
if (type)
return {
headline: type.headline,
first: type.first,
firstMath: type.firstMath,
second: type.second,
secondMath: type.secondMath,
}
this.throwError('no additional transaction info for this type')
},
throwError(msg) {
throw new Error(msg)
if (type) return type
throw new Error('no additional transaction info for this type')
},
},
}