mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
50 lines
1005 B
JavaScript
50 lines
1005 B
JavaScript
import { mount } from '@vue/test-utils'
|
|
import UserCardLanguage from './UserCard_Language'
|
|
|
|
const localVue = global.localVue
|
|
|
|
const mockAPIcall = jest.fn()
|
|
|
|
const toastErrorMock = jest.fn()
|
|
const toastSuccessMock = jest.fn()
|
|
const storeCommitMock = jest.fn()
|
|
|
|
describe('UserCard_Language', () => {
|
|
let wrapper
|
|
|
|
const mocks = {
|
|
$t: jest.fn((t) => t),
|
|
$store: {
|
|
state: {
|
|
language: 'de',
|
|
},
|
|
commit: storeCommitMock,
|
|
},
|
|
$toasted: {
|
|
success: toastSuccessMock,
|
|
error: toastErrorMock,
|
|
},
|
|
$apollo: {
|
|
query: mockAPIcall,
|
|
},
|
|
}
|
|
|
|
const Wrapper = () => {
|
|
return mount(UserCardLanguage, { localVue, mocks })
|
|
}
|
|
|
|
describe('mount', () => {
|
|
beforeEach(() => {
|
|
wrapper = Wrapper()
|
|
})
|
|
|
|
it('renders the component', () => {
|
|
expect(wrapper.find('div#formuserlanguage').exists()).toBeTruthy()
|
|
})
|
|
|
|
it('has an edit icon', () => {
|
|
expect(wrapper.find('svg.bi-pencil').exists()).toBeTruthy()
|
|
})
|
|
})
|
|
})
|