From 42025bc9ca2d4a1df063f3c48c391b1261c5f5a7 Mon Sep 17 00:00:00 2001 From: Dmytro Melnyshyn Date: Mon, 25 Nov 2024 15:13:45 +0200 Subject: [PATCH] fix tests --- src/MarcRoute/MarcRoute.test.js | 6 +-- .../QuickMarcEditorContainer.test.js | 48 +++++++++---------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/MarcRoute/MarcRoute.test.js b/src/MarcRoute/MarcRoute.test.js index 4e34a644..1e8754d3 100644 --- a/src/MarcRoute/MarcRoute.test.js +++ b/src/MarcRoute/MarcRoute.test.js @@ -40,7 +40,7 @@ const renderMarcRoute = ({ history, ...props } = {}) => (render( describe('Given Quick Marc', () => { beforeEach(() => { useUserTenantPermissions.mockReturnValue({ - userPermissions: [], + userPermissions: new Set(), isFetching: false, }); @@ -49,9 +49,7 @@ describe('Given Quick Marc', () => { describe('when a member tenant edits shared record', () => { it('should fetch the central tenant permissions', () => { - const userPermissions = [{ - permissionName: 'ui-quick-marc.quick-marc-editor.all', - }]; + const userPermissions = new Set(['ui-quick-marc.quick-marc-editor.all']); useUserTenantPermissions.mockReturnValue({ userPermissions, diff --git a/src/QuickMarcEditor/QuickMarcEditorContainer.test.js b/src/QuickMarcEditor/QuickMarcEditorContainer.test.js index bf42fbc7..ebc6f46c 100644 --- a/src/QuickMarcEditor/QuickMarcEditorContainer.test.js +++ b/src/QuickMarcEditor/QuickMarcEditorContainer.test.js @@ -282,16 +282,16 @@ describe('Given Quick Marc Editor Container', () => { }); }); - recordLengthField = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.Record length' }); - statusField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Status' }); - typeField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Type' }); - blvlField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.BLvl' }); - ctrlField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Ctrl' }); - positions9to16Field = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.9-16 positions' }); - elvlField = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.tip.ELvl' }); - descField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Desc' }); - multiLvlField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.MultiLvl' }); - positions20to23Field = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.20-23 positions' }); + recordLengthField = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.Record length/ }); + statusField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Status/ }); + typeField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Type/ }); + blvlField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.BLvl/ }); + ctrlField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Ctrl/ }); + positions9to16Field = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.9-16 positions/ }); + elvlField = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.tip.ELvl/ }); + descField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Desc/ }); + multiLvlField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.MultiLvl/ }); + positions20to23Field = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.20-23 positions/ }); }); it('should display correct default values', () => { @@ -408,13 +408,13 @@ describe('Given Quick Marc Editor Container', () => { }); }); - recordLengthField = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.Record length' }); - statusField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Status' }); - typeField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Type' }); - positions7to16Field = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.7-16 positions' }); - elvlField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.ELvl' }); - punctField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Punct' }); - positions19to23Field = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.19-23 positions' }); + recordLengthField = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.Record length/ }); + statusField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Status/ }); + typeField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Type/ }); + positions7to16Field = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.7-16 positions/ }); + elvlField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.ELvl/ }); + punctField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Punct/ }); + positions19to23Field = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.19-23 positions/ }); }); it('should display correct default values', () => { @@ -492,13 +492,13 @@ describe('Given Quick Marc Editor Container', () => { }); }); - recordLengthField = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.Record length' }); - statusField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Status' }); - typeField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Type' }); - positions7to16Field = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.7-16 positions' }); - elvlField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.ELvl' }); - itemField = screen.getByRole('combobox', { name: 'ui-quick-marc.record.fixedField.tip.Item' }); - positions19to23Field = screen.getByRole('textbox', { name: 'ui-quick-marc.record.fixedField.19-23 positions' }); + recordLengthField = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.Record length/ }); + statusField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Status/ }); + typeField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Type/ }); + positions7to16Field = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.7-16 positions/ }); + elvlField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.ELvl/ }); + itemField = screen.getByRole('combobox', { name: /ui-quick-marc.record.fixedField.tip.Item/ }); + positions19to23Field = screen.getByRole('textbox', { name: /ui-quick-marc.record.fixedField.19-23 positions/ }); }); it('should display correct default values', async () => {