diff options
author | David Cho-Lerat <david.cho-lerat@sonarsource.com> | 2024-02-16 11:24:05 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-03-07 20:02:26 +0000 |
commit | 4faac4cd3b55144b3d84b23b623be92ae2509fcf (patch) | |
tree | 287781cea16cb4cb2459c04e5bf0221826a0c188 /server/sonar-web/src/main/js/helpers/__tests__ | |
parent | 256df883c1f3a498301663531c6330cf6ac7a136 (diff) | |
download | sonarqube-4faac4cd3b55144b3d84b23b623be92ae2509fcf.tar.gz sonarqube-4faac4cd3b55144b3d84b23b623be92ae2509fcf.zip |
SONAR-19032 Migrate global messages to MIUI
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/__tests__')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/__tests__/error-test.ts | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts | 49 |
2 files changed, 3 insertions, 51 deletions
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts index 9fd8e5ff4ff..495b93d3880 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts @@ -17,10 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +import { addGlobalErrorMessage } from 'design-system'; import { throwGlobalError } from '../error'; -import { addGlobalErrorMessage } from '../globalMessages'; -jest.mock('../../helpers/globalMessages', () => ({ +jest.mock('design-system', () => ({ addGlobalErrorMessage: jest.fn(), })); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts deleted file mode 100644 index c96d31344df..00000000000 --- a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { MessageLevel } from '../../types/globalMessages'; -import { - addGlobalErrorMessage, - addGlobalSuccessMessage, - registerListener, -} from '../globalMessages'; - -it('should work as expected', () => { - const listener1 = jest.fn(); - registerListener(listener1); - - addGlobalErrorMessage('test'); - - expect(listener1).toHaveBeenCalledWith( - expect.objectContaining({ text: 'test', level: MessageLevel.Error }), - ); - - listener1.mockClear(); - const listener2 = jest.fn(); - registerListener(listener2); - - addGlobalSuccessMessage('test'); - - expect(listener1).toHaveBeenCalledWith( - expect.objectContaining({ text: 'test', level: MessageLevel.Success }), - ); - expect(listener2).toHaveBeenCalledWith( - expect.objectContaining({ text: 'test', level: MessageLevel.Success }), - ); -}); |