diff --git a/.betterer.results b/.betterer.results
index ce7e62f1484..209db07b306 100644
--- a/.betterer.results
+++ b/.betterer.results
@@ -68,9 +68,6 @@ exports[`no enzyme tests`] = {
"public/app/features/alerting/AlertRuleList.test.tsx:2998938420": [
[0, 19, 13, "RegExp match", "2409514259"]
],
- "public/app/features/alerting/TestRuleResult.test.tsx:2358420489": [
- [0, 19, 13, "RegExp match", "2409514259"]
- ],
"public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx:3716733755": [
[0, 35, 13, "RegExp match", "2409514259"]
],
diff --git a/public/app/features/alerting/TestRuleResult.test.tsx b/public/app/features/alerting/TestRuleResult.test.tsx
index 46ac94f248f..17cadde5f53 100644
--- a/public/app/features/alerting/TestRuleResult.test.tsx
+++ b/public/app/features/alerting/TestRuleResult.test.tsx
@@ -1,4 +1,4 @@
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import React from 'react';
import { DashboardModel, PanelModel } from '../dashboard/state';
@@ -16,35 +16,20 @@ jest.mock('@grafana/runtime', () => {
};
});
-const setup = (propOverrides?: object) => {
- const props: Props = {
- panel: new PanelModel({ id: 1 }),
- dashboard: new DashboardModel({ panels: [{ id: 1 }] }),
- };
-
- Object.assign(props, propOverrides);
-
- const wrapper = shallow();
-
- return { wrapper, instance: wrapper.instance() as TestRuleResult };
+const props: Props = {
+ panel: new PanelModel({ id: 1 }),
+ dashboard: new DashboardModel({ panels: [{ id: 1 }] }),
};
-describe('Render', () => {
- it('should render component', () => {
- const { wrapper } = setup();
+describe('TestRuleResult', () => {
+ it('should render without error', () => {
+ expect(() => render()).not.toThrow();
+ });
- expect(wrapper).toMatchSnapshot();
- });
-});
+ it('should call testRule when mounting', () => {
+ jest.spyOn(TestRuleResult.prototype, 'testRule');
+ render();
-describe('Life cycle', () => {
- describe('component did mount', () => {
- it('should call testRule', () => {
- const { instance } = setup();
- instance.testRule = jest.fn();
- instance.componentDidMount();
-
- expect(instance.testRule).toHaveBeenCalled();
- });
+ expect(TestRuleResult.prototype.testRule).toHaveBeenCalled();
});
});
diff --git a/public/app/features/alerting/__snapshots__/TestRuleResult.test.tsx.snap b/public/app/features/alerting/__snapshots__/TestRuleResult.test.tsx.snap
deleted file mode 100644
index abbdb915531..00000000000
--- a/public/app/features/alerting/__snapshots__/TestRuleResult.test.tsx.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Render should render component 1`] = `
-
-`;