mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Changed the logic so that we check if the queries have been send but does not check the result.
This commit is contained in:
parent
80a5939551
commit
3d3a77a0ea
@ -1,4 +1,5 @@
|
||||
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||
import { communities, communityInfo } from '../../graphql/queries'
|
||||
import RegisterSelectCommunity from './RegisterSelectCommunity'
|
||||
|
||||
const localVue = global.localVue
|
||||
@ -92,16 +93,20 @@ describe('RegisterSelectCommunity', () => {
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
// TODO: Tests so that resolved value order is followed
|
||||
it('commits the community info to the store', () => {
|
||||
expect(mockStoreCommit).toBeCalledWith('community', {
|
||||
name: 'test12',
|
||||
description: 'test community 12',
|
||||
url: 'http://test12.test12/',
|
||||
registerUrl: 'http://test12.test12/vue/register',
|
||||
it('calls the API to get the community info data', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith({
|
||||
query: communityInfo,
|
||||
})
|
||||
})
|
||||
|
||||
it('calls the API to get the communities data', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith({
|
||||
query: communities,
|
||||
fetchPolicy: 'network-only',
|
||||
})
|
||||
})
|
||||
|
||||
@ -135,47 +140,15 @@ describe('RegisterSelectCommunity', () => {
|
||||
url: 'http://localhost/vue/',
|
||||
registerUrl: 'http://localhost/vue/register-community',
|
||||
}
|
||||
apolloQueryMock
|
||||
.mockResolvedValueOnce({
|
||||
data: {
|
||||
getCommunityInfo: {
|
||||
name: 'Gradido Entwicklung',
|
||||
url: 'http://localhost/vue/',
|
||||
registerUrl: 'http://localhost/vue/register',
|
||||
description: 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||
},
|
||||
},
|
||||
})
|
||||
.mockResolvedValue({
|
||||
data: {
|
||||
communities: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Gradido Entwicklung',
|
||||
description: 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||
url: 'http://localhost/vue/',
|
||||
registerUrl: 'http://localhost/vue/register-community',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Gradido Staging',
|
||||
description: 'Der Testserver der Gradido-Akademie.',
|
||||
url: 'https://stage1.gradido.net/vue/',
|
||||
registerUrl: 'https://stage1.gradido.net/vue/register-community',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Gradido-Akademie',
|
||||
description: 'Freies Institut für Wirtschaftsbionik.',
|
||||
url: 'https://gradido.net',
|
||||
registerUrl: 'https://gdd1.gradido.com/vue/register-community',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('does not call community info data when already filled', () => {
|
||||
expect(apolloQueryMock).not.toBeCalledWith({
|
||||
query: communityInfo,
|
||||
})
|
||||
})
|
||||
|
||||
it('has a Community name', () => {
|
||||
expect(wrapper.find('.card-body b').text()).toBe('Gradido Entwicklung')
|
||||
})
|
||||
@ -191,7 +164,7 @@ describe('RegisterSelectCommunity', () => {
|
||||
describe('server returns data', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper = Wrapper()
|
||||
await wrapper.setProps({
|
||||
await wrapper.setData({
|
||||
communities: [
|
||||
{
|
||||
id: 2,
|
||||
@ -226,7 +199,6 @@ describe('RegisterSelectCommunity', () => {
|
||||
|
||||
describe('server response is error', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
apolloQueryMock.mockRejectedValue({
|
||||
message: 'Wrong thing',
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user