Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Vanshika <[email protected]>
  • Loading branch information
Vanshikav123 committed Dec 22, 2023
1 parent cc17c8f commit 5c1b280
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/ui/react-app/src/pages/graph/QueryStatsView.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';
import QueryStatsView from './QueryStatsView';

describe('QueryStatsView', () => {
Expand All @@ -10,11 +10,11 @@ describe('QueryStatsView', () => {
resultSeries: 10000,
traceID: 'e575f9d4eab63a90cdc3dc4ef1b8dda0',
};
const queryStatsView = shallow(<QueryStatsView {...queryStatsProps} />);
expect(queryStatsView.prop('className')).toEqual('query-stats');
expect(queryStatsView.children().prop('className')).toEqual('float-right');
expect(queryStatsView.children().text()).toEqual(
`Load time: ${queryStatsProps.loadTime}ms   Resolution: ${queryStatsProps.resolution}s   Result series: ${queryStatsProps.resultSeries}   Trace ID: ${queryStatsProps.traceID}`
const queryStatsView = mount(<QueryStatsView {...queryStatsProps} />);
expect(queryStatsView.find('.query-stats').prop('className')).toEqual('query-stats');
expect(queryStatsView.find('.float-right').prop('className')).toEqual('float-right');
expect(queryStatsView.find('.float-right').html()).toEqual(
`<span class="float-right">Load time: ${queryStatsProps.loadTime}ms   Resolution: ${queryStatsProps.resolution}s   Result series: ${queryStatsProps.resultSeries}   Trace ID: ${queryStatsProps.traceID}</span>`
);
});
});
3 changes: 2 additions & 1 deletion pkg/ui/react-app/src/pages/graph/QueryStatsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export interface QueryStats {
const QueryStatsView: FC<QueryStats> = (props) => {
const { loadTime, resolution, resultSeries, traceID } = props;
const prev = `Load time: ${loadTime}ms &ensp; Resolution: ${resolution}s &ensp; Result series: ${resultSeries}`;
const str = traceID ? prev + ` &ensp; TraceID: ${traceID}` : prev;
const str = traceID ? prev + ` &ensp; Trace ID: ${traceID}` : prev;

return (
<div className="query-stats">
<span className="float-right" dangerouslySetInnerHTML={{ __html: str }}></span>
Expand Down

0 comments on commit 5c1b280

Please sign in to comment.