From 0be22fcc277e46e99611272f86df970fe95f5d4f Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 17 Aug 2022 10:51:25 +0200 Subject: [PATCH] fix test --- .../TransactionConfirmationLink.spec.js | 1 - frontend/src/components/Menu/Sidebar.spec.js | 107 +++++++------ frontend/src/routes/router.test.js | 150 +++++++++--------- 3 files changed, 130 insertions(+), 128 deletions(-) diff --git a/frontend/src/components/GddSend/TransactionConfirmationLink.spec.js b/frontend/src/components/GddSend/TransactionConfirmationLink.spec.js index 4f26b64cf..91207901c 100644 --- a/frontend/src/components/GddSend/TransactionConfirmationLink.spec.js +++ b/frontend/src/components/GddSend/TransactionConfirmationLink.spec.js @@ -47,7 +47,6 @@ describe('GddSend confirm', () => { }) }) - describe('has totalBalance under 0', () => { beforeEach(async () => { await wrapper.setProps({ diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index 5f67f38a5..efb7f2864 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -46,27 +46,36 @@ describe('Sidebar', () => { expect(wrapper.findAll('.nav-item').at(1).text()).toEqual('navigation.send') }) - it('has first nav-item "gdt.gdt" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('gdt.gdt') + it('has first nav-item "gdt.gdt" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('gdt.gdt') + }) + + it('has first nav-item "navigation.community" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(4).text()).toContain('navigation.community') + }) + + it('has first nav-item "navigation.profile" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.profile') + }) }) - it('has first nav-item "navigation.community" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(4).text()).toContain('navigation.community') - }) + describe('navigation Navbar (user has an elopage account)', () => { + it('has eight b-nav-item in the navbar', () => { + expect(wrapper.findAll('.nav-item')).toHaveLength(9) + }) - it('has first nav-item "navigation.profile" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.profile') - }) - }) + it('has a link to the members area', () => { + expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.members_area') + expect(wrapper.findAll('.nav-item').at(6).find('a').attributes('href')).toBe('#') + }) - describe('navigation Navbar (user has an elopage account)', () => { - it('has eight b-nav-item in the navbar', () => { - expect(wrapper.findAll('.nav-item')).toHaveLength(9) - }) + it('has first nav-item "navigation.admin_area" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.admin_area') + }) - it('has a link to the members area', () => { - expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.members_area') - expect(wrapper.findAll('.nav-item').at(6).find('a').attributes('href')).toBe('#') + it('has first nav-item "navigation.logout" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.logout') + }) }) it('has first nav-item "navigation.admin_area" in navbar', () => { @@ -78,51 +87,41 @@ describe('Sidebar', () => { }) }) - it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.admin_area') - }) - - it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.logout') - }) + describe('navigation Navbar (user has no elopage account)', () => { + beforeAll(() => { + mocks.$store.state.hasElopage = false + wrapper = Wrapper() }) - describe('navigation Navbar (user has no elopage account)', () => { - beforeAll(() => { - mocks.$store.state.hasElopage = false - wrapper = Wrapper() - }) - - it('has eight b-nav-item in the navbar', () => { - expect(wrapper.findAll('.nav-item')).toHaveLength(8) - }) - - it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') - }) - - it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') - }) + it('has eight b-nav-item in the navbar', () => { + expect(wrapper.findAll('.nav-item')).toHaveLength(8) }) - describe('navigation Navbar (user has no elopage account)', () => { - beforeAll(() => { - mocks.$store.state.hasElopage = false - wrapper = Wrapper() - }) + it('has first nav-item "navigation.admin_area" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') + }) - it('has eight b-nav-item in the navbar', () => { - expect(wrapper.findAll('.nav-item')).toHaveLength(8) - }) + it('has first nav-item "navigation.logout" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') + }) + }) - it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') - }) + describe('navigation Navbar (user has no elopage account)', () => { + beforeAll(() => { + mocks.$store.state.hasElopage = false + wrapper = Wrapper() + }) - it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') - }) + it('has eight b-nav-item in the navbar', () => { + expect(wrapper.findAll('.nav-item')).toHaveLength(8) + }) + + it('has first nav-item "navigation.admin_area" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') + }) + + it('has first nav-item "navigation.logout" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') }) }) }) diff --git a/frontend/src/routes/router.test.js b/frontend/src/routes/router.test.js index 2f0fa55b8..f8c7ef389 100644 --- a/frontend/src/routes/router.test.js +++ b/frontend/src/routes/router.test.js @@ -127,90 +127,94 @@ describe('router', () => { it('loads the "InfoStatistic" page', async () => { const component = await routes.find((r) => r.path === '/info').component() expect(component.default.name).toBe('InfoStatistic') - - describe('gdt', () => { - it('requires authorization', () => { - expect(routes.find((r) => r.path === '/gdt').meta.requiresAuth).toBeTruthy() - }) - it('loads the "GDT" page', async () => { - const component = await routes.find((r) => r.path === '/gdt').component() - expect(component.default.name).toBe('Transactions') - }) - }) + describe('gdt', () => { + it('requires authorization', () => { + expect(routes.find((r) => r.path === '/gdt').meta.requiresAuth).toBeTruthy() + }) - describe('login', () => { - it('loads the "Login" page', async () => { - const component = await routes.find((r) => r.path === '/login/:code?').component() - expect(component.default.name).toBe('Login') - }) - }) + it('loads the "GDT" page', async () => { + const component = await routes.find((r) => r.path === '/gdt').component() + expect(component.default.name).toBe('Transactions') + }) + }) - describe('register', () => { - it('loads the "register" page', async () => { - const component = await routes.find((r) => r.path === '/register/:code?').component() - expect(component.default.name).toBe('Register') - }) - }) + describe('login', () => { + it('loads the "Login" page', async () => { + const component = await routes.find((r) => r.path === '/login/:code?').component() + expect(component.default.name).toBe('Login') + }) + }) - describe('forgot password', () => { - it('loads the "ForgotPassword" page', async () => { - const component = await routes.find((r) => r.path === '/forgot-password').component() - expect(component.default.name).toBe('ForgotPassword') - }) - }) + describe('register', () => { + it('loads the "register" page', async () => { + const component = await routes.find((r) => r.path === '/register/:code?').component() + expect(component.default.name).toBe('Register') + }) + }) - describe('password with param comingFrom', () => { - it('loads the "ForgotPassword" page', async () => { - const component = await routes - .find((r) => r.path === '/forgot-password/:comingFrom') - .component() - expect(component.default.name).toBe('ForgotPassword') - }) - }) + describe('forgot password', () => { + it('loads the "ForgotPassword" page', async () => { + const component = await routes.find((r) => r.path === '/forgot-password').component() + expect(component.default.name).toBe('ForgotPassword') + }) + }) - describe('register-community', () => { - it('loads the "registerCommunity" page', async () => { - const component = await routes.find((r) => r.path === '/register-community').component() - expect(component.default.name).toBe('RegisterCommunity') - }) - }) + describe('password with param comingFrom', () => { + it('loads the "ForgotPassword" page', async () => { + const component = await routes + .find((r) => r.path === '/forgot-password/:comingFrom') + .component() + expect(component.default.name).toBe('ForgotPassword') + }) + }) - describe('select-community', () => { - it('loads the "SelectCommunity" page', async () => { - const component = await routes.find((r) => r.path === '/select-community').component() - expect(component.default.name).toBe('SelectCommunity') - }) - }) + describe('register-community', () => { + it('loads the "registerCommunity" page', async () => { + const component = await routes + .find((r) => r.path === '/register-community') + .component() + expect(component.default.name).toBe('RegisterCommunity') + }) + }) - describe('reset password', () => { - it('loads the "ResetPassword" page', async () => { - const component = await routes - .find((r) => r.path === '/reset-password/:optin') - .component() - expect(component.default.name).toBe('ResetPassword') - }) - }) + describe('select-community', () => { + it('loads the "SelectCommunity" page', async () => { + const component = await routes.find((r) => r.path === '/select-community').component() + expect(component.default.name).toBe('SelectCommunity') + }) + }) - describe('checkEmail', () => { - it('loads the "CheckEmail" page', async () => { - const component = await routes - .find((r) => r.path === '/checkEmail/:optin/:code?') - .component() - expect(component.default.name).toBe('ResetPassword') - }) - }) + describe('reset password', () => { + it('loads the "ResetPassword" page', async () => { + const component = await routes + .find((r) => r.path === '/reset-password/:optin') + .component() + expect(component.default.name).toBe('ResetPassword') + }) + }) - describe('redeem', () => { - it('loads the "TransactionLink" page', async () => { - const component = await routes.find((r) => r.path === '/redeem/:code').component() - expect(component.default.name).toBe('TransactionLink') - }) - }) + describe('checkEmail', () => { + it('loads the "CheckEmail" page', async () => { + const component = await routes + .find((r) => r.path === '/checkEmail/:optin/:code?') + .component() + expect(component.default.name).toBe('ResetPassword') + }) + }) - describe('not found page', () => { - it('renders the "NotFound" page', async () => { - expect(routes.find((r) => r.path === '*').component).toEqual(NotFound) + describe('redeem', () => { + it('loads the "TransactionLink" page', async () => { + const component = await routes.find((r) => r.path === '/redeem/:code').component() + expect(component.default.name).toBe('TransactionLink') + }) + }) + + describe('not found page', () => { + it('renders the "NotFound" page', async () => { + expect(routes.find((r) => r.path === '*').component).toEqual(NotFound) + }) + }) }) }) })