diff --git a/.betterer.results b/.betterer.results index 4da356b24ab..4146be12bc7 100644 --- a/.betterer.results +++ b/.betterer.results @@ -92,9 +92,6 @@ exports[`no enzyme tests`] = { "packages/jaeger-ui-components/src/TraceTimelineViewer/index.test.js:276996587": [ [14, 19, 13, "RegExp match", "2409514259"] ], - "packages/jaeger-ui-components/src/url/ReferenceLink.test.js:261377050": [ - [14, 26, 13, "RegExp match", "2409514259"] - ], "public/app/core/components/PageActionBar/PageActionBar.test.tsx:1251504193": [ [0, 19, 13, "RegExp match", "2409514259"] ], diff --git a/packages/jaeger-ui-components/src/url/ReferenceLink.test.js b/packages/jaeger-ui-components/src/url/ReferenceLink.test.tsx similarity index 55% rename from packages/jaeger-ui-components/src/url/ReferenceLink.test.js rename to packages/jaeger-ui-components/src/url/ReferenceLink.test.tsx index 2d8e76a009b..cfc9fbc78ff 100644 --- a/packages/jaeger-ui-components/src/url/ReferenceLink.test.js +++ b/packages/jaeger-ui-components/src/url/ReferenceLink.test.tsx @@ -1,4 +1,4 @@ -// Copyright (c) 2019 The Jaeger Authors. +// Copyright (c) 2019 Uber Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,30 +12,43 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { shallow, mount } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import React from 'react'; +import { LinkModel } from '@grafana/data'; + +import { TraceSpanReference } from '../types/trace'; + import ReferenceLink from './ReferenceLink'; describe(ReferenceLink, () => { const createFocusSpanLinkMock = jest.fn((traceId, spanId) => { - return { + const model: LinkModel = { href: `${traceId}-${spanId}`, + title: 'link', + origin: 'origin', + target: '_blank', }; + return model; }); - const ref = { + const ref: TraceSpanReference = { refType: 'FOLLOWS_FROM', traceID: 'trace1', spanID: 'span1', }; - describe('rendering', () => { - it('renders reference with correct href', () => { - const component = shallow(); - const link = component.find('a'); - expect(link.length).toBe(1); - expect(link.prop('href')).toBe('trace1-span1'); + describe('rendering', () => { + it('renders reference with correct href', async () => { + render( + + link + + ); + + const link = await screen.findByText('link'); + expect(link).toBeInTheDocument(); + expect(link).toHaveAttribute('href', 'trace1-span1'); }); }); });