Skip to content

Commit

Permalink
Fix tests and outdated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed May 31, 2024
1 parent c1e977a commit 3f77707
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const FieldStatisticsTable = React.memo((props: FieldStatisticsTableProps
const lastReloadRequestTime$ = useMemo(() => {
return stateContainer?.dataState?.refetch$
? stateContainer?.dataState?.refetch$.pipe(
map((d) => {
map(() => {
return Date.now();
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ export const DiscoverMainContent = ({

const setDiscoverViewMode = useCallback(
(mode: VIEW_MODE) => {
stateContainer.appState.update(
// Resetting to default viewMode: undefined if document level
// else change for viewMode from undefined to DOCUMENT_LEVEL will triger unsaved changes badge
{ viewMode: mode },
true
);
stateContainer.appState.update({ viewMode: mode }, true);

if (trackUiMetric) {
if (mode === VIEW_MODE.AGGREGATED_LEVEL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('useEsqlMode', () => {
stateContainer.dataState.data$.documents$.next(msgComplete);
expect(replaceUrlState).toHaveBeenCalledTimes(0);
});
test('should change viewMode to undefined (default) if it was AGGREGATED_LEVEL', async () => {
test('should not change viewMode to undefined (default) if it was AGGREGATED_LEVEL', async () => {
const { replaceUrlState } = renderHookWithContext(false, {
viewMode: VIEW_MODE.AGGREGATED_LEVEL,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getValidViewMode = ({
isEsqlMode: boolean;
}): VIEW_MODE | undefined => {
if (viewMode === VIEW_MODE.PATTERN_LEVEL && isEsqlMode) {
// only this mode is supported for text-based languages
// only this mode is supported for ES|QL languages
return VIEW_MODE.DOCUMENT_LEVEL;
}

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/group6/_view_mode_toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await testSubjects.existOrFail('dscViewModeToggle');
});

it('should still show view mode toggle for text-based searches', async () => {
it('should still show view mode toggle for ES|QL searches', async () => {
await testSubjects.click('dscViewModeDocumentButton');

await retry.try(async () => {
Expand Down

0 comments on commit 3f77707

Please sign in to comment.