fix review, fix more tests in transaction.spec and transactionCollaps

This commit is contained in:
ogerly 2021-09-09 09:05:38 +02:00
parent 95e937f6e1
commit 28b871f11b
6 changed files with 56 additions and 43 deletions

View File

@ -3,8 +3,6 @@ import Transaction from './Transaction'
const localVue = global.localVue
const toastErrorMock = jest.fn()
describe('Transaction', () => {
let wrapper
@ -15,16 +13,13 @@ describe('Transaction', () => {
$t: jest.fn((t) => t),
$n: jest.fn((n) => n),
$d: jest.fn((d) => d),
$toasted: {
error: toastErrorMock,
},
}
const propsData = {
amount: 100,
gdt: 110,
factor: 22,
comment: '',
comment: 'this is the comment for a gdt transaction',
date: '2020-04-10T13:28:00+00:00',
gdtEntryType: 4,
}
@ -41,5 +36,29 @@ describe('Transaction', () => {
it('renders the component', () => {
expect(wrapper.find('div.gdt-transaction-list-item').exists()).toBeTruthy()
})
it('checks the prop amount ', () => {
expect(wrapper.props().amount).toBe(100)
})
it('checks the prop gdt ', () => {
expect(wrapper.props().gdt).toBe(110)
})
it('checks the prop factor ', () => {
expect(wrapper.props().factor).toBe(22)
})
it('checks the prop comment ', () => {
expect(wrapper.props().comment).toBe('this is the comment for a gdt transaction')
})
it('checks the prop date ', () => {
expect(wrapper.props().date).toBe('2020-04-10T13:28:00+00:00')
})
it('checks the prop gdtEntryType ', () => {
expect(wrapper.props().gdtEntryType).toBe(4)
})
})
})

View File

@ -115,7 +115,7 @@ export default {
const type = linesByType[givenType]
if (type) return type
throw new Error('no lines for this type')
throw new Error('no lines for this type: ' + givenType)
},
},
}

View File

@ -3,25 +3,23 @@ import TransactionCollapse from './TransactionCollapse'
const localVue = global.localVue
const toastErrorMock = jest.fn()
describe('TransactionCollapse', () => {
let wrapper
const mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t),
$n: jest.fn((n) => n),
$d: jest.fn((d) => d),
$toasted: {
error: toastErrorMock,
},
}
const propsData = {
amount: 100,
gdt: 110,
factor: 22,
gdtEntryType: 4,
}
const Wrapper = () => {
return mount(TransactionCollapse, { localVue, mocks })
return mount(TransactionCollapse, { localVue, mocks, propsData })
}
describe('mount', () => {
@ -30,7 +28,23 @@ describe('TransactionCollapse', () => {
})
it('renders the component', () => {
expect(wrapper.find('div.gdt-transaction-collaps').exists()).toBeTruthy()
expect(wrapper.find('div.gdt-transaction-collapse').exists()).toBeTruthy()
})
it('checks the prop amount ', () => {
expect(wrapper.props().amount).toBe(100)
})
it('checks the prop gdt ', () => {
expect(wrapper.props().gdt).toBe(110)
})
it('checks the prop factor ', () => {
expect(wrapper.props().factor).toBe(22)
})
it('checks the prop gdtEntryType ', () => {
expect(wrapper.props().gdtEntryType).toBe(4)
})
})
})

View File

@ -1,5 +1,5 @@
<template>
<div class="gdt-transaction-collaps">
<div class="gdt-transaction-collapse">
<b-row class="gdt-list-clooaps-header-text text-center pb-3">
<div class="col h4">
{{ getLinesByType(gdtEntryType).headline }}
@ -69,7 +69,7 @@ export default {
const type = linesByType[givenType]
if (type) return type
throw new Error('no additional transaction info for this type')
throw new Error('no additional transaction info for this type: ' + givenType)
},
},
}

View File

@ -137,16 +137,6 @@
"send_gradido":"Gradido versenden",
"add_work":"neuer Gemeinschaftsbeitrag"
},
"profil": {
"transactions":"Transaktionen",
"activity": {
"new":"Neue Gemeinschaftsstunden eintragen",
"list":"Meine Gemeinschaftsstunden Liste"
},
"user-data": {
"change-success": "Deine Daten wurden gespeichert."
}
},
"navbar" : {
"my-profil":"Mein Profil",
"settings":"Einstellungen",
@ -184,7 +174,7 @@
"formula":"Berechungsformel",
"no-transactions":"Du hast zur Zeit keine Transaktionen",
"publisher":"Dein geworbenes Mitglied hat einen Beitrag bezahlt",
"action":"Action",
"action":"Aktion",
"gdt-receive":"GDT erhalten",
"recruited-member":"Geworbenes Mitglied",
"contribution":"Beitrag"

View File

@ -137,16 +137,6 @@
"send_gradido":"Send Gradido",
"add_work":"New Community Contribution"
},
"profil": {
"transactions":"transactions",
"activity": {
"new":"Register new community hours",
"list":"My Community Hours List"
},
"user-data": {
"change-success": "Your data has been saved."
}
},
"navbar" : {
"my-profil":"My profile",
"settings":"Settings",
@ -184,9 +174,9 @@
"formula": "Calculation formula",
"no-transactions":"You currently have no transactions",
"publisher":"A member you referred has paid a contribution",
"action":"Aktion",
"action":"Action",
"gdt-receive":"GDT receive",
"recruited-member":"Your share",
"recruited-member":"Recruited Member",
"contribution":"Contribution"
}
}