diff --git a/.betterer.results b/.betterer.results index 7f27fd80d8f..12d1729d2e1 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1765,12 +1765,6 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] ], - "public/app/features/alerting/unified/components/receivers/DuplicateTemplateView.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/alerting/unified/components/receivers/EditTemplateView.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], "public/app/features/alerting/unified/components/receivers/GlobalConfigForm.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], diff --git a/public/app/features/alerting/unified/Templates.test.tsx b/public/app/features/alerting/unified/Templates.test.tsx index a18a74475b7..6d695af5826 100644 --- a/public/app/features/alerting/unified/Templates.test.tsx +++ b/public/app/features/alerting/unified/Templates.test.tsx @@ -1,7 +1,12 @@ import * as React from 'react'; -import { render, screen } from 'test/test-utils'; +import { Props } from 'react-virtualized-auto-sizer'; +import { render, screen, within } from 'test/test-utils'; +import { byRole } from 'testing-library-selector'; +import { CodeEditorProps } from '@grafana/ui/src/components/Monaco/types'; +import { AppNotificationList } from 'app/core/components/AppNotifications/AppNotificationList'; import { setupMswServer } from 'app/features/alerting/unified/mockApi'; +import { testWithFeatureToggles } from 'app/features/alerting/unified/test/test-utils'; import { AccessControlAction } from 'app/types'; import Templates from './Templates'; @@ -11,6 +16,38 @@ jest.mock('app/core/components/AppChrome/AppChromeUpdate', () => ({ AppChromeUpdate: ({ actions }: { actions: React.ReactNode }) =>
{actions}
, })); +//mock updateDefinesWithUniqueValue +jest.mock('app/features/alerting/unified/utils/templates', () => ({ + ...jest.requireActual('app/features/alerting/unified/utils/templates'), + updateDefinesWithUniqueValue: (templateContent: string) => { + return templateContent.replace(/custom-email/g, 'custom-email_NEW'); + }, +})); + +jest.mock( + 'react-virtualized-auto-sizer', + () => + ({ children }: Props) => + children({ width: 1000, height: 1000, scaledWidth: 1, scaledHeight: 1 }) +); + +jest.mock('@grafana/ui', () => ({ + ...jest.requireActual('@grafana/ui'), + CodeEditor: ({ value, onChange }: CodeEditorProps) => ( +