Skip to content

Commit

Permalink
[test] Migrate DAG.test.js from Enzyme to RTL (#1694)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- This PR migrates the `DAG.test.js` from Enzyme to RTL
- part of: #1668

## How was this change tested?
- Using `yarn test-ci`

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: Ansh Goyal <[email protected]>
  • Loading branch information
anshgoyalevil authored Aug 17, 2023
1 parent 451aba6 commit 09d9696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/jaeger-ui/src/components/DependencyGraph/DAG.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default class DAG extends React.Component {
left: 0,
top: 0,
}}
data-testid="cy"
ref={this.cytoscapeRef}
/>
);
Expand Down
8 changes: 5 additions & 3 deletions packages/jaeger-ui/src/components/DependencyGraph/DAG.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -63,7 +63,8 @@ describe('<DAG>', () => {
parent: 'parent-id',
},
];
expect(mount(<DAG serviceCalls={serviceCalls} />)).toBeDefined();
render(<DAG serviceCalls={serviceCalls} />);
expect(screen.getByTestId('cy')).toBeDefined();
});

it('does not explode with empty strings or string with only spaces', () => {
Expand All @@ -74,6 +75,7 @@ describe('<DAG>', () => {
parent: ' ',
},
];
expect(mount(<DAG serviceCalls={serviceCalls} />)).toBeDefined();
render(<DAG serviceCalls={serviceCalls} />);
expect(screen.getByTestId('cy')).toBeDefined();
});
});

0 comments on commit 09d9696

Please sign in to comment.