From 537573ca9450f954ffdfc38975b531347d99c563 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 30 Jun 2023 12:00:16 +0200 Subject: [PATCH] fix test src/components/UserSettings/UserName.spec.js --- .../components/UserSettings/UserName.spec.js | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/UserSettings/UserName.spec.js b/frontend/src/components/UserSettings/UserName.spec.js index 43649f2e6..2fff0e4e7 100644 --- a/frontend/src/components/UserSettings/UserName.spec.js +++ b/frontend/src/components/UserSettings/UserName.spec.js @@ -65,37 +65,45 @@ describe('UserName Form', () => { expect(wrapper.vm.username).toEqual('') }) - describe.skip('change / edit username', () => { + describe('change / edit username', () => { beforeEach(async () => { - wrapper.$store.state.username = '' + mocks.$store.state.username = '' await wrapper.setData({ isEdit: true }) }) it('first step is isEdit false ', () => { expect(wrapper.vm.isEdit).toEqual(true) }) - + it(' has username-alert text ', () => { + expect(wrapper.find('[data-test="username-alert"]').text()).toBe( + 'settings.username.no-username', + ) + }) it('has a submit button with disabled true', () => { - // expect(wrapper.find('[data-test="submit-username-button"]').exists()).toBeFalsy() - // expect(wrapper.find('select.role-select[disabled="disabled"]').exists()).toBe(false) - // expect(wrapper.find('[data-test="submit-username-button"]').attributes('disabled')).toBe(true + expect(wrapper.find('[data-test="submit-username-button"]').exists()).toBeFalsy() + // expect(wrapper.find('[data-test="submit-username-button"]').attributes('disabled')).toBe(true) // expect(wrapper.find('[data-test="submit-username-button"]').prop('disabled')).toBeFalsy() - expect(wrapper.find('[data-test="submit-username-button"]').attributes('disabled')).toBe( - 'disabled', - ) + // expect(wrapper.find('[data-test="submit-username-button"]').attributes('disabled')).toBe( + // 'disabled', + // ) }) }) - describe.skip('has a username', () => { + describe('has a username', () => { beforeEach(async () => { - wrapper.$store.state.username = 'petra' + mocks.$store.state.username = 'petra' + wrapper.setData({ isEdit: true }) }) it('has no the username', () => { expect(wrapper.find('[data-test="username-input-group"]')).toBeTruthy() }) + it(' has no username-alert text ', () => { + expect(wrapper.find('[data-test="username-alert"]').exists()).toBe(false) + }) + it('has no component username change ', () => { expect(wrapper.findComponent({ name: 'InputUsername' }).exists()).toBeTruthy() })