From 71dc6628eda6e9af44e9dd1de490a753d0277d4d Mon Sep 17 00:00:00 2001 From: Victor-Nyagudi Date: Mon, 23 Feb 2026 17:14:16 +0300 Subject: [PATCH] test(brand_image_setting): use destructured functions --- .../brand_image_setting.test.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/webapp/channels/src/components/admin_console/brand_image_setting/brand_image_setting.test.tsx b/webapp/channels/src/components/admin_console/brand_image_setting/brand_image_setting.test.tsx index 6b16a9e896c..3c786a44226 100644 --- a/webapp/channels/src/components/admin_console/brand_image_setting/brand_image_setting.test.tsx +++ b/webapp/channels/src/components/admin_console/brand_image_setting/brand_image_setting.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import {Client4} from 'mattermost-redux/client'; -import {screen, renderWithContext, userEvent, waitFor} from 'tests/react_testing_utils'; +import {renderWithContext, userEvent, waitFor} from 'tests/react_testing_utils'; import BrandImageSetting from './brand_image_setting'; @@ -55,33 +55,33 @@ describe('components/admin_console/brand_image_setting', () => { }); test('should show delete button if brand image exists', async () => { - renderWithContext(); + const {getByTestId} = renderWithContext(); await waitFor(() => expect(scope.isDone()).toBe(true)); - expect(screen.getByTestId(deleteButtonTestId)).toBeVisible(); + expect(getByTestId(deleteButtonTestId)).toBeVisible(); }); test('should hide delete button if the setting is disabled', async () => { const props = {...baseProps, disabled: true}; - renderWithContext(); + const {queryByTestId} = renderWithContext(); - await waitFor(() => expect(screen.queryByTestId(deleteButtonTestId)).toBe(null)); + await waitFor(() => expect(queryByTestId(deleteButtonTestId)).toBe(null)); }); test('should call setSaveNeeded when a brand image is uploaded', async () => { - renderWithContext(); + const {getByTestId} = renderWithContext(); - await userEvent.upload(screen.getByTestId('file__upload-input'), new File(['brand_image_file'], 'brand_image_file.png', {type: 'image/png'})); + await userEvent.upload(getByTestId('file__upload-input'), new File(['brand_image_file'], 'brand_image_file.png', {type: 'image/png'})); expect(baseProps.setSaveNeeded).toHaveBeenCalledTimes(1); }); test('should call setSaveNeeded when the delete button is pressed', async () => { - renderWithContext(); + const {findByTestId} = renderWithContext(); - const deleteButton = await screen.findByTestId(deleteButtonTestId); + const deleteButton = await findByTestId(deleteButtonTestId); await userEvent.click(deleteButton);