yarn test fixed

This commit is contained in:
ogerly 2022-03-14 10:47:01 +01:00
parent 15f8ed3ca0
commit a46bdb69bc
4 changed files with 8 additions and 71 deletions

View File

@ -1,63 +0,0 @@
import { mount } from '@vue/test-utils'
import TransactionConfirmation from './TransactionConfirmationLink'
const localVue = global.localVue
describe('GddSend confirm', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
$i18n: {
locale: jest.fn(() => 'en'),
},
$n: jest.fn((n) => String(n)),
}
const propsData = {
balance: 1234,
email: 'user@example.org',
amount: 12.34,
memo: 'Pessimisten stehen im Regen, Optimisten duschen unter den Wolken.',
loading: false,
selected: 'send',
}
const Wrapper = () => {
return mount(TransactionConfirmation, { localVue, mocks, propsData })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the component div.transaction-confirm', () => {
expect(wrapper.find('div.transaction-confirm').exists()).toBeTruthy()
})
describe('has selected "send"', () => {
beforeEach(async () => {
await wrapper.setProps({
selected: 'send',
})
})
it('renders the component div.confirm-box-send', () => {
expect(wrapper.find('div.confirm-box-send').exists()).toBeTruthy()
})
})
describe('has selected "link"', () => {
beforeEach(async () => {
await wrapper.setProps({
selected: 'link',
})
})
it('renders the component div.confirm-box-link', () => {
expect(wrapper.findAll('div.confirm-box-link').at(0).exists()).toBeTruthy()
})
})
})
})

View File

@ -51,7 +51,7 @@
</template>
<script>
export default {
name: 'TransactionConfirmation',
name: 'TransactionConfirmationLink',
props: {
balance: { type: Number, required: true },
email: { type: String, required: false, default: '' },

View File

@ -75,7 +75,7 @@
</template>
<script>
export default {
name: 'TransactionConfirmationLink',
name: 'TransactionConfirmationSend',
props: {
balance: { type: Number, required: true },
email: { type: String, required: false, default: '' },

View File

@ -55,7 +55,7 @@ describe('Send', () => {
})
})
it('steps forward in the dialog', () => {
expect(wrapper.findComponent({ name: 'TransactionConfirmation' }).exists()).toBe(true)
expect(wrapper.findComponent({ name: 'TransactionConfirmationSend' }).exists()).toBe(true)
})
})
@ -73,7 +73,7 @@ describe('Send', () => {
})
it('resets the transaction process when on-reset is emitted', async () => {
await wrapper.findComponent({ name: 'TransactionConfirmation' }).vm.$emit('on-reset')
await wrapper.findComponent({ name: 'TransactionConfirmationSend' }).vm.$emit('on-reset')
expect(wrapper.findComponent({ name: 'TransactionForm' }).exists()).toBeTruthy()
expect(wrapper.vm.transactionData).toEqual({
email: 'user@example.org',
@ -87,7 +87,7 @@ describe('Send', () => {
beforeEach(async () => {
jest.clearAllMocks()
await wrapper
.findComponent({ name: 'TransactionConfirmation' })
.findComponent({ name: 'TransactionConfirmationSend' })
.vm.$emit('send-transaction')
})
@ -119,7 +119,7 @@ describe('Send', () => {
jest.clearAllMocks()
sendMock.mockRejectedValue({ message: 'recipient not known' })
await wrapper
.findComponent({ name: 'TransactionConfirmation' })
.findComponent({ name: 'TransactionConfirmationSend' })
.vm.$emit('send-transaction')
})
@ -147,7 +147,7 @@ describe('Send', () => {
})
})
it('steps forward in the dialog', () => {
expect(wrapper.findComponent({ name: 'TransactionConfirmation' }).exists()).toBe(true)
expect(wrapper.findComponent({ name: 'TransactionConfirmationLink' }).exists()).toBe(true)
})
})
@ -164,7 +164,7 @@ describe('Send', () => {
})
it('resets the transaction process when on-reset is emitted', async () => {
await wrapper.findComponent({ name: 'TransactionConfirmation' }).vm.$emit('on-reset')
await wrapper.findComponent({ name: 'TransactionConfirmationSend' }).vm.$emit('on-reset')
expect(wrapper.findComponent({ name: 'TransactionForm' }).exists()).toBeTruthy()
expect(wrapper.vm.transactionData).toEqual({
email: '',