unit test kontoOverview/GddStatus

This commit is contained in:
Moriz Wahl 2021-04-13 00:29:37 +02:00
parent bebb937aee
commit 5a17d5aeea
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,42 @@
import { mount } from '@vue/test-utils'
import GddStatus from './GddStatus'
import Vuex from 'vuex'
const localVue = global.localVue
describe('GddStatus', () => {
let wrapper
let state = {
user: {
balance: 1234,
balance_gdt: 9876,
},
}
let store = new Vuex.Store({
state,
})
let mocks = {
$n: jest.fn((n) => n),
}
const Wrapper = () => {
return mount(GddStatus, { localVue, store, mocks })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('it displays the ammount of GDD', () => {
expect(wrapper.findAll('div.card-body').at(0).text()).toEqual('1234 GDD')
})
it('it displays the ammount of GDT', () => {
expect(wrapper.findAll('div.card-body').at(1).text()).toEqual('9876 GDT')
})
})
})

View File

@ -15,6 +15,7 @@ import VueRouter from 'vue-router'
import BaseDropdown from '@/components/BaseDropdown.vue'
import VueQrcode from 'vue-qrcode'
import BaseHeader from '@/components/BaseHeader'
import StatsCard from '@/components/Cards/StatsCard.vue'
import clickOutside from '@/directives/click-ouside.js'
@ -42,5 +43,6 @@ global.localVue.component('validation-observer', ValidationObserver)
global.localVue.component(BaseButton.name, BaseButton)
global.localVue.component(BaseDropdown.name, BaseDropdown)
global.localVue.component(BaseHeader.name, BaseHeader)
global.localVue.component(StatsCard.name, StatsCard)
global.localVue.directive('click-outside', clickOutside)