From 9728d3a22bbd8cfa095ca9034ed1fccd820c459e Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 11 Jan 2021 10:48:54 -0500 Subject: [PATCH] Modify example unit test revision for specificity. --- .../__snapshots__/ml_job_link.test.tsx.snap | 20 ------------------- .../monitor/ml/ml_job_link.test.tsx | 14 +++++++++---- 2 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/ml_job_link.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/ml_job_link.test.tsx.snap b/x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/ml_job_link.test.tsx.snap deleted file mode 100644 index 1992309f4f468..0000000000000 --- a/x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/ml_job_link.test.tsx.snap +++ /dev/null @@ -1,20 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ML JobLink renders without errors 1`] = ` - - - - - - - -`; diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.test.tsx index b661441344a27..53f3bafb128bd 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.test.tsx @@ -5,17 +5,23 @@ */ import React from 'react'; -import { render } from '../../../lib'; +import { render } from '../../../lib/helper/component_test_helpers'; import { MLJobLink } from './ml_job_link'; describe('ML JobLink', () => { it('renders without errors', () => { - const { asFragment } = render( - , + const expectedHref = `/app/ml#/explorer?_g=(ml:(jobIds:!(testmonitor_high_latency_by_geo)),refreshInterval:(pause:!t,value:0),time:(from:'',to:''))&_a=(mlExplorerFilter:(filterActive:!t,filteredFields:!(monitor.id,testMonitor)),mlExplorerSwimlane:(viewByFieldName:observer.geo.name))`; + const { getByRole, getByText } = render( + +
Test link
+
, { coreOptions: { triggersActionsUi: { getEditAlertFlyout: jest.fn() } }, } ); - expect(asFragment()).toMatchSnapshot(); + + const jobLink = getByRole('link'); + expect(jobLink.getAttribute('href')).toBe(expectedHref); + expect(getByText('Test link')); }); });