fix tests

This commit is contained in:
Moriz Wahl 2022-06-17 13:58:46 +02:00
parent 6ecc10318d
commit 4475da0fbe
3 changed files with 21 additions and 19 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="redeem-self-creator">
<redeem-information :firstName="user.firstName" :amount="amount" :memo="memo" />
<redeem-information v-bind="linkData" :isContributionLink="isContributionLink" />
<b-jumbotron>
<div class="mb-3 text-center">
@ -23,9 +23,8 @@ export default {
RedeemInformation,
},
props: {
user: { type: Object, required: true },
amount: { type: String, required: true },
memo: { type: String, required: true, default: '' },
linkData: { type: Object, required: true },
isContributionLink: { type: Boolean, default: false },
},
}
</script>

View File

@ -24,6 +24,7 @@ const transactionLinkValidExpireDate = () => {
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',
@ -91,6 +92,7 @@ describe('TransactionLink', () => {
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',
@ -121,6 +123,7 @@ describe('TransactionLink', () => {
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',
@ -151,6 +154,7 @@ describe('TransactionLink', () => {
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',
@ -178,9 +182,11 @@ describe('TransactionLink', () => {
describe('no token in store', () => {
beforeEach(() => {
mocks.$store.state.token = null
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',
@ -211,14 +217,10 @@ describe('TransactionLink', () => {
describe('token in store and own link', () => {
beforeEach(() => {
mocks.$store.state.token = 'token'
wrapper.setData({
linkData: {
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
},
})
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',
@ -234,13 +236,12 @@ describe('TransactionLink', () => {
})
it('has a RedeemValid component', () => {
// expect(wrapper.findComponent({ name: 'RedeemSelfCreator' }).exists()).toBe(true)
expect(wrapper.findComponent({ name: 'RedeemValid' }).exists()).toBe(true)
expect(wrapper.findComponent({ name: 'RedeemSelfCreator' }).exists()).toBe(true)
})
it.skip('has a no redeem text', () => {
expect(wrapper.findComponent({ name: 'RedeemValid' }).text()).toContain(
`Bibi transaction-link.send_you + 123.45 GDD memo· gdd_per_link.redeem`,
it('has a no redeem text', () => {
expect(wrapper.findComponent({ name: 'RedeemSelfCreator' }).text()).toContain(
'gdd_per_link.no-redeem',
)
})
@ -255,6 +256,7 @@ describe('TransactionLink', () => {
apolloQueryMock.mockResolvedValue({
data: {
queryTransactionLink: {
__typename: 'TransactionLink',
id: 92,
amount: '22',
memo: 'Abrakadabra drei, vier, fünf, sechs, hier steht jetzt ein Memotext! Hex hex ',

View File

@ -7,7 +7,7 @@
</template>
<template #SELF_CREATOR>
<redeem-self-creator v-bind="linkData" />
<redeem-self-creator :linkData="linkData" />
</template>
<template #VALID>
@ -47,6 +47,7 @@ export default {
return {
img: '/img/brand/green.png',
linkData: {
__typename: 'TransactionLink',
amount: '123.45',
memo: 'memo',
user: {
@ -76,8 +77,8 @@ export default {
this.toastError(err.message)
})
},
async mutationLink(amount) {
await this.$apollo
mutationLink(amount) {
this.$apollo
.mutate({
mutation: redeemTransactionLink,
variables: {
@ -98,8 +99,8 @@ export default {
})
},
redeemLink(amount) {
this.$bvModal.msgBoxConfirm(this.$t('gdd_per_link.redeem-text')).then(async (value) => {
if (value) await this.mutationLink(amount)
this.$bvModal.msgBoxConfirm(this.$t('gdd_per_link.redeem-text')).then((value) => {
if (value) this.mutationLink(amount)
})
},
},