diff --git a/.betterer.results b/.betterer.results index 5e7941b52da..01561ab5feb 100644 --- a/.betterer.results +++ b/.betterer.results @@ -74,9 +74,6 @@ exports[`no enzyme tests`] = { "public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx:3716733755": [ [0, 35, 13, "RegExp match", "2409514259"] ], - "public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx:2723773538": [ - [0, 35, 13, "RegExp match", "2409514259"] - ], "public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:4164297658": [ [0, 17, 13, "RegExp match", "2409514259"] ], @@ -4281,8 +4278,7 @@ exports[`better eslint`] = { ], "public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/features/dashboard/dashgrid/DashboardGrid.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx index 95963ad97d5..28d0ac6f398 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx @@ -1,4 +1,4 @@ -import { shallow, ShallowWrapper } from 'enzyme'; +import { render } from '@testing-library/react'; import React from 'react'; import { DashboardModel } from '../state'; @@ -12,13 +12,6 @@ jest.mock('app/features/dashboard/dashgrid/LazyLoader', () => { return { LazyLoader }; }); -interface ScenarioContext { - props: Props; - wrapper?: ShallowWrapper; - setup: (fn: () => void) => void; - setProps: (props: Partial) => void; -} - function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel { const data = Object.assign( { @@ -57,43 +50,14 @@ function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel return new DashboardModel(data, meta); } -function dashboardGridScenario(description: string, scenarioFn: (ctx: ScenarioContext) => void) { - describe(description, () => { - let setupFn: () => void; - - const ctx: ScenarioContext = { - setup: (fn) => { - setupFn = fn; - }, - props: { - editPanel: null, - viewPanel: null, - dashboard: getTestDashboard(), - cleanAndRemoveMany: jest.fn, - }, - setProps: (props: Partial) => { - Object.assign(ctx.props, props); - if (ctx.wrapper) { - ctx.wrapper.setProps(ctx.props); - } - }, - }; - - beforeEach(() => { - setupFn(); - ctx.wrapper = shallow(); - }); - - scenarioFn(ctx); - }); -} - describe('DashboardGrid', () => { - dashboardGridScenario('Can render dashboard grid', (ctx) => { - ctx.setup(() => {}); - - it('Should render', () => { - expect(ctx.wrapper).toMatchSnapshot(); - }); + it('should render without error', () => { + const props: Props = { + editPanel: null, + viewPanel: null, + dashboard: getTestDashboard(), + cleanAndRemoveMany: jest.fn, + }; + expect(() => render()).not.toThrow(); }); }); diff --git a/public/app/features/dashboard/dashgrid/__snapshots__/DashboardGrid.test.tsx.snap b/public/app/features/dashboard/dashgrid/__snapshots__/DashboardGrid.test.tsx.snap deleted file mode 100644 index 8431540227c..00000000000 --- a/public/app/features/dashboard/dashgrid/__snapshots__/DashboardGrid.test.tsx.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DashboardGrid Can render dashboard grid Should render 1`] = ` -
- - - -
-`;