Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added trace detail tests #5523

Merged
merged 16 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: added test cases of undefined filters and items
  • Loading branch information
SagarRajput-7 committed Jul 31, 2024
commit 79d59d0388ac90cf9dba3237b9350fd638b3aef6
47 changes: 47 additions & 0 deletions frontend/src/pages/TracesExplorer/__test__/TracesExplorer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,51 @@ describe('TracesExplorer - ', () => {
expect(await findByText('HTTP GET /customer')).toBeInTheDocument();
expect(getByTestId('name-HTTP GET /customer')).toBeChecked();
});

it('test edge cases of undefined filters', async () => {
jest.spyOn(compositeQueryHook, 'useGetCompositeQueryParam').mockReturnValue({
...compositeQuery,
builder: {
...compositeQuery.builder,
queryData: compositeQuery.builder.queryData.map(
(item) =>
({
...item,
filters: undefined,
} as any),
),
},
});

const { getByText } = render(<Filter setOpen={jest.fn()} />);

Object.values(AllTraceFilterKeyValue).forEach((filter) => {
expect(getByText(filter)).toBeInTheDocument();
});
});

it('test edge cases of undefined filters - items', async () => {
jest.spyOn(compositeQueryHook, 'useGetCompositeQueryParam').mockReturnValue({
...compositeQuery,
builder: {
...compositeQuery.builder,
queryData: compositeQuery.builder.queryData.map(
(item) =>
({
...item,
filters: {
...item.filters,
items: undefined,
},
} as any),
),
},
});

const { getByText } = render(<Filter setOpen={jest.fn()} />);

Object.values(AllTraceFilterKeyValue).forEach((filter) => {
expect(getByText(filter)).toBeInTheDocument();
});
});
});