From 5b23cae4bcb5476ca7f7b9a861898fe5a2271c1e Mon Sep 17 00:00:00 2001 From: Jiawei Wu Date: Wed, 1 Nov 2023 13:00:15 -0700 Subject: [PATCH] Add test --- .../create_maintenance_windows_form.test.tsx | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx index dc78b4455d54b..c5fb3bdf8357a 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx @@ -189,6 +189,43 @@ describe('CreateMaintenanceWindowForm', () => { expect(managementInput).toBeChecked(); }); + it('should initialize MWs with selected category ids properly', async () => { + const result = appMockRenderer.render( + + ); + + await waitFor(() => { + expect( + result.queryByTestId('maintenanceWindowCategorySelectionLoading') + ).not.toBeInTheDocument(); + }); + + const observabilityInput = within( + result.getByTestId('maintenanceWindowCategorySelection') + ).getByTestId('checkbox-observability'); + const securityInput = within( + result.getByTestId('maintenanceWindowCategorySelection') + ).getByTestId('checkbox-securitySolution'); + const managementInput = within( + result.getByTestId('maintenanceWindowCategorySelection') + ).getByTestId('checkbox-management'); + + expect(observabilityInput).toBeChecked(); + expect(managementInput).toBeChecked(); + expect(securityInput).not.toBeChecked(); + }); + it('can select category IDs', async () => { const result = appMockRenderer.render();