mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add test files for RegisterCommunity and RegisterSelectCommunity, fix tests for RegisterCommunity
This commit is contained in:
parent
2065bcbfb7
commit
d91fc76fcc
91
frontend/src/views/Pages/RegisterCommunity.spec.js
Normal file
91
frontend/src/views/Pages/RegisterCommunity.spec.js
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
|
import flushPromises from 'flush-promises'
|
||||||
|
import RegisterCommunity from './RegisterCommunity'
|
||||||
|
|
||||||
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
describe('RegisterCommunity', () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
const mocks = {
|
||||||
|
$i18n: {
|
||||||
|
locale: 'en',
|
||||||
|
},
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
$store: {
|
||||||
|
state: {
|
||||||
|
community: {
|
||||||
|
name: 'Gradido Entwicklung',
|
||||||
|
url: 'http://localhost:3000/vue/',
|
||||||
|
registerUrl: 'http://localhost:3000/vue/register',
|
||||||
|
description: 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(RegisterCommunity, { localVue, mocks })
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('mount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the Div Element "#register-community"', () => {
|
||||||
|
expect(wrapper.find('div#register-community').exists()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Displaying the current community info', () => {
|
||||||
|
it('has a current community name', () => {
|
||||||
|
expect(wrapper.find('.header h1').text()).toBe('Gradido Entwicklung')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a current community description', () => {
|
||||||
|
expect(wrapper.find('.header p').text()).toBe('Die lokale Entwicklungsumgebung von Gradido.')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a current community location', () => {
|
||||||
|
expect(wrapper.find('.header p.community-location').text()).toBe('Location: http://localhost:3000/vue/')
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
describe('buttons and links', () => {
|
||||||
|
it('has a button "Continue to registration?"', () => {
|
||||||
|
expect(wrapper.findAll('a').at(0).text()).toEqual(
|
||||||
|
'community.continue-to-registration',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('button links to /register when clicking "Continue to registration"', () => {
|
||||||
|
expect(wrapper.findAll('a').at(0).props().to).toBe('/register')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a button "Choose another community?"', () => {
|
||||||
|
expect(wrapper.findAll('a').at(1).text()).toEqual(
|
||||||
|
'community.choose-another-community',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('button links to /select-community when clicking "Choose another community"', () => {
|
||||||
|
expect(wrapper.findAll('a').at(1).props().to).toBe('/select-community')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a button "Back to Login?"', () => {
|
||||||
|
expect(wrapper.findAll('a').at(2).text()).toEqual(
|
||||||
|
'back',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('button links to /login when clicking "Back to Login"', () => {
|
||||||
|
expect(wrapper.findAll('a').at(2).props().to).toBe('/login')
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="register-select-community">
|
<div id="register-community">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<b-container>
|
<b-container>
|
||||||
@ -8,10 +8,10 @@
|
|||||||
<b-col xl="5" lg="6" md="8" class="px-2">
|
<b-col xl="5" lg="6" md="8" class="px-2">
|
||||||
<h1>{{ $store.state.community.name }}</h1>
|
<h1>{{ $store.state.community.name }}</h1>
|
||||||
<p class="text-lead">
|
<p class="text-lead">
|
||||||
{{ $store.state.community.description }},
|
{{ $store.state.community.description }}
|
||||||
<br />
|
</p>
|
||||||
Location:
|
<p class="text-lead community-location">
|
||||||
{{ $store.state.community.url }}
|
Location: {{ $store.state.community.url }}
|
||||||
</p>
|
</p>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|||||||
42
frontend/src/views/Pages/RegisterSelectCommunity.spec.js
Normal file
42
frontend/src/views/Pages/RegisterSelectCommunity.spec.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
|
import flushPromises from 'flush-promises'
|
||||||
|
import RegisterSelectCommunity from './RegisterSelectCommunity'
|
||||||
|
|
||||||
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
describe('RegisterSelectCommunity', () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
const mocks = {
|
||||||
|
$i18n: {
|
||||||
|
locale: 'en',
|
||||||
|
},
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
$store: {
|
||||||
|
state: {
|
||||||
|
community: {
|
||||||
|
name: 'Gradido Entwicklung',
|
||||||
|
url: 'http://localhost:3000/vue/',
|
||||||
|
registerUrl: 'http://localhost:3000/vue/register',
|
||||||
|
description: 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(RegisterSelectCommunity, { localVue, mocks })
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('mount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the Div Element "#register-select-community"', () => {
|
||||||
|
expect(wrapper.find('div#register-select-community').exists()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user