Skip to content

Commit 2acb3fd

Browse files
committed
adding back tests
1 parent 233e390 commit 2acb3fd

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import { render, screen } from '@mongodb-js/testing-library-compass';
3+
import IndexFlowSection from './index-flow-section';
4+
import { expect } from 'chai';
5+
6+
describe('IndexFlowSection', () => {
7+
const renderComponent = (createIndexFieldsComponent?: JSX.Element) => {
8+
render(
9+
<IndexFlowSection
10+
createIndexFieldsComponent={createIndexFieldsComponent ?? null}
11+
/>
12+
);
13+
};
14+
it('renders the Input Index header', () => {
15+
renderComponent();
16+
expect(screen.getByText('Input Index')).to.exist;
17+
});
18+
19+
it('renders the Code Equivalent toggle', () => {
20+
renderComponent();
21+
expect(screen.getByLabelText('Toggle Code Equivalent')).to.exist;
22+
});
23+
24+
it('renders the Show me covered queries button', () => {
25+
renderComponent();
26+
expect(screen.getByText('Show me covered queries')).to.exist;
27+
});
28+
29+
it('renders the Covered Queries header', () => {
30+
renderComponent();
31+
expect(screen.getByText('Covered Queries')).to.exist;
32+
});
33+
34+
it('renders the provided createIndexFieldsComponent', () => {
35+
const mockComponent = (
36+
<div data-testid="mock-component">Mock Component</div>
37+
);
38+
renderComponent(mockComponent);
39+
expect(screen.getByTestId('mock-component')).to.exist;
40+
});
41+
42+
it('renders the covered queries examples', () => {
43+
renderComponent();
44+
expect(screen.getByTestId('index-flow-section-covered-queries-examples')).to
45+
.exist;
46+
});
47+
48+
it('renders the optimal query examples', () => {
49+
renderComponent();
50+
expect(screen.getByTestId('index-flow-section-optimal-query-examples')).to
51+
.exist;
52+
});
53+
54+
it('renders the Learn More link', () => {
55+
renderComponent();
56+
const link = screen.getByText('Learn More');
57+
expect(link).to.exist;
58+
});
59+
});

0 commit comments

Comments
 (0)