From 1cd7cf0b5efdef39b1fc1d42c31c721e5e6da50e Mon Sep 17 00:00:00 2001 From: Ansh Goyal Date: Thu, 17 Aug 2023 19:46:57 +0530 Subject: [PATCH] Migrate DAG.test.js from Enzyme to RTL Signed-off-by: Ansh Goyal --- packages/jaeger-ui/src/components/DependencyGraph/DAG.jsx | 1 + .../jaeger-ui/src/components/DependencyGraph/DAG.test.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/jaeger-ui/src/components/DependencyGraph/DAG.jsx b/packages/jaeger-ui/src/components/DependencyGraph/DAG.jsx index b5b0296e65..47cf6a637b 100644 --- a/packages/jaeger-ui/src/components/DependencyGraph/DAG.jsx +++ b/packages/jaeger-ui/src/components/DependencyGraph/DAG.jsx @@ -110,6 +110,7 @@ export default class DAG extends React.Component { left: 0, top: 0, }} + data-testid="cy" ref={this.cytoscapeRef} /> ); diff --git a/packages/jaeger-ui/src/components/DependencyGraph/DAG.test.js b/packages/jaeger-ui/src/components/DependencyGraph/DAG.test.js index bed510db48..bcfdd34a6f 100644 --- a/packages/jaeger-ui/src/components/DependencyGraph/DAG.test.js +++ b/packages/jaeger-ui/src/components/DependencyGraph/DAG.test.js @@ -13,7 +13,7 @@ // limitations under the License. import React from 'react'; -import { mount } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import DAG from './DAG'; // mock canvas API (we don't care about canvas results) @@ -63,7 +63,8 @@ describe('', () => { parent: 'parent-id', }, ]; - expect(mount()).toBeDefined(); + render(); + expect(screen.getByTestId('cy')).toBeDefined(); }); it('does not explode with empty strings or string with only spaces', () => { @@ -74,6 +75,7 @@ describe('', () => { parent: ' ', }, ]; - expect(mount()).toBeDefined(); + render(); + expect(screen.getByTestId('cy')).toBeDefined(); }); });