mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix test over 96%
This commit is contained in:
parent
1947575034
commit
a918735630
@ -42,14 +42,30 @@ describe('ContributionLink', () => {
|
||||
expect(wrapper.find('div.contribution-link').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('emits toggle::collapse new Contribution', async () => {
|
||||
wrapper.vm.editContributionLinkData()
|
||||
expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy()
|
||||
describe('function editContributionLinkData', () => {
|
||||
beforeEach(() => {
|
||||
wrapper.vm.editContributionLinkData()
|
||||
})
|
||||
it('emits toggle::collapse new Contribution', async () => {
|
||||
await expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
it('emits toggle::collapse close Contribution-Form ', async () => {
|
||||
wrapper.vm.closeContributionForm()
|
||||
expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy()
|
||||
describe('function closeContributionForm', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setData({ visible: true })
|
||||
wrapper.vm.closeContributionForm()
|
||||
})
|
||||
|
||||
it('emits toggle::collapse close Contribution-Form ', async () => {
|
||||
await expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy()
|
||||
})
|
||||
it('editContributionLink is false', async () => {
|
||||
await expect(wrapper.vm.editContributionLink).toBe(false)
|
||||
})
|
||||
it('contributionLinkData is empty', async () => {
|
||||
await expect(wrapper.vm.contributionLinkData).toEqual({})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -88,5 +88,16 @@ describe('CreationTransactionList', () => {
|
||||
expect(toastErrorSpy).toBeCalledWith('OUCH!')
|
||||
})
|
||||
})
|
||||
|
||||
describe('watch currentPage', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.setData({ currentPage: 2 })
|
||||
})
|
||||
|
||||
it('returns the string in normal order if reversed property is not true', () => {
|
||||
expect(wrapper.vm.currentPage).toBe(2)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
18
admin/src/locales/index.test.js
Normal file
18
admin/src/locales/index.test.js
Normal file
@ -0,0 +1,18 @@
|
||||
import locales from './index.js'
|
||||
|
||||
describe('locales', () => {
|
||||
it('should contain 2 locales', () => {
|
||||
expect(locales).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('should contain a German locale', () => {
|
||||
expect(locales).toContainEqual(
|
||||
expect.objectContaining({
|
||||
name: 'Deutsch',
|
||||
code: 'de',
|
||||
iso: 'de-DE',
|
||||
enabled: true,
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
@ -1,6 +1,7 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import ContributionLinks from './ContributionLinks.vue'
|
||||
import { listContributionLinks } from '@/graphql/listContributionLinks.js'
|
||||
import { toastErrorSpy } from '../../test/testSetup'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
@ -46,13 +47,31 @@ describe('ContributionLinks', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
describe('apollo returns', () => {
|
||||
it('calls listContributionLinks', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
query: listContributionLinks,
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('calls listContributionLinks', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
query: listContributionLinks,
|
||||
}),
|
||||
)
|
||||
describe.skip('query transaction with error', () => {
|
||||
beforeEach(() => {
|
||||
apolloQueryMock.mockRejectedValue({ message: 'OUCH!' })
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('calls the API', () => {
|
||||
expect(apolloQueryMock).toBeCalled()
|
||||
})
|
||||
|
||||
it('toast error', () => {
|
||||
expect(toastErrorSpy).toBeCalledWith(
|
||||
'listContributionLinks has no result, use default data',
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user