mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
improve unit test structure for better readability
This commit is contained in:
parent
a8437ee492
commit
bb120b8b82
@ -43,9 +43,11 @@ describe('Navbar', () => {
|
|||||||
it('has .navbar-brand in the navbar', () => {
|
it('has .navbar-brand in the navbar', () => {
|
||||||
expect(wrapper.find('.navbar-brand').exists()).toBeTruthy()
|
expect(wrapper.find('.navbar-brand').exists()).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has b-navbar-toggle in the navbar', () => {
|
it('has b-navbar-toggle in the navbar', () => {
|
||||||
expect(wrapper.find('.navbar-toggler').exists()).toBeTruthy()
|
expect(wrapper.find('.navbar-toggler').exists()).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has ten b-nav-item in the navbar', () => {
|
it('has ten b-nav-item in the navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item')).toHaveLength(10)
|
expect(wrapper.findAll('.nav-item')).toHaveLength(10)
|
||||||
})
|
})
|
||||||
@ -57,16 +59,20 @@ describe('Navbar', () => {
|
|||||||
it('has first nav-item "navigation.overview" in navbar', () => {
|
it('has first nav-item "navigation.overview" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('navigation.overview')
|
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('navigation.overview')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.send" in navbar', () => {
|
it('has first nav-item "navigation.send" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.send')
|
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.send')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.transactions" in navbar', () => {
|
it('has first nav-item "navigation.transactions" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.transactions')
|
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.transactions')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.profile" in navbar', () => {
|
it('has first nav-item "navigation.profile" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.profile')
|
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.profile')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('navigation Navbar (user has an elopage account)', () => {
|
describe('navigation Navbar (user has an elopage account)', () => {
|
||||||
it('has a link to the members area', () => {
|
it('has a link to the members area', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(7).text()).toContain('navigation.members_area')
|
expect(wrapper.findAll('.nav-item').at(7).text()).toContain('navigation.members_area')
|
||||||
@ -78,23 +84,28 @@ describe('Navbar', () => {
|
|||||||
it('has first nav-item "navigation.admin_area" in navbar', () => {
|
it('has first nav-item "navigation.admin_area" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.admin_area')
|
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.admin_area')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.logout" in navbar', () => {
|
it('has first nav-item "navigation.logout" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.logout')
|
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.logout')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('navigation Navbar (user has no elopage account)', () => {
|
describe('navigation Navbar (user has no elopage account)', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mocks.$store.state.hasElopage = false
|
mocks.$store.state.hasElopage = false
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.admin_area" in navbar', () => {
|
it('has first nav-item "navigation.admin_area" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.admin_area')
|
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.admin_area')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.logout" in navbar', () => {
|
it('has first nav-item "navigation.logout" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.logout')
|
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.logout')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('check watch visible true', () => {
|
describe('check watch visible true', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await wrapper.setProps({ visible: true })
|
await wrapper.setProps({ visible: true })
|
||||||
|
|||||||
@ -27,6 +27,7 @@ describe('Sidebar', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the component', () => {
|
it('renders the component', () => {
|
||||||
expect(wrapper.find('div#component-sidebar').exists()).toBeTruthy()
|
expect(wrapper.find('div#component-sidebar').exists()).toBeTruthy()
|
||||||
})
|
})
|
||||||
@ -52,11 +53,12 @@ describe('Sidebar', () => {
|
|||||||
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile')
|
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// ----
|
|
||||||
describe('navigation Navbar (user has an elopage account)', () => {
|
describe('navigation Navbar (user has an elopage account)', () => {
|
||||||
it('has seven b-nav-item in the navbar', () => {
|
it('has seven b-nav-item in the navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item')).toHaveLength(8)
|
expect(wrapper.findAll('.nav-item')).toHaveLength(8)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has a link to the members area', () => {
|
it('has a link to the members area', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.members_area')
|
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.members_area')
|
||||||
expect(wrapper.findAll('.nav-item').at(5).find('a').attributes('href')).toBe('#')
|
expect(wrapper.findAll('.nav-item').at(5).find('a').attributes('href')).toBe('#')
|
||||||
@ -70,17 +72,21 @@ describe('Sidebar', () => {
|
|||||||
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout')
|
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('navigation Navbar (user has no elopage account)', () => {
|
describe('navigation Navbar (user has no elopage account)', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mocks.$store.state.hasElopage = false
|
mocks.$store.state.hasElopage = false
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has six b-nav-item in the navbar', () => {
|
it('has six b-nav-item in the navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item')).toHaveLength(7)
|
expect(wrapper.findAll('.nav-item')).toHaveLength(7)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.admin_area" in navbar', () => {
|
it('has first nav-item "navigation.admin_area" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.admin_area')
|
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.admin_area')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has first nav-item "navigation.logout" in navbar', () => {
|
it('has first nav-item "navigation.logout" in navbar', () => {
|
||||||
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.logout')
|
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.logout')
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user