Commit 2b7b176a authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '332890-use-similarity-sort-for-search-project-dropdown' into 'master'

Use similarity sort in search project dropdown

See merge request gitlab-org/gitlab!69899
parents 0536b808 2113d961
...@@ -40,7 +40,7 @@ export const fetchProjects = ({ commit, state }, search) => { ...@@ -40,7 +40,7 @@ export const fetchProjects = ({ commit, state }, search) => {
); );
} else { } else {
// The .catch() is due to the API method not handling a rejection properly // The .catch() is due to the API method not handling a rejection properly
Api.projects(search, { order_by: 'id' }, callback).catch(() => { Api.projects(search, { order_by: 'similarity' }, callback).catch(() => {
callback(); callback();
}); });
} }
......
...@@ -142,7 +142,13 @@ describe('Global Search Store Actions', () => { ...@@ -142,7 +142,13 @@ describe('Global Search Store Actions', () => {
actions.fetchProjects({ commit: mockCommit, state }); actions.fetchProjects({ commit: mockCommit, state });
expect(Api.groupProjects).not.toHaveBeenCalled(); expect(Api.groupProjects).not.toHaveBeenCalled();
expect(Api.projects).toHaveBeenCalled(); expect(Api.projects).toHaveBeenCalledWith(
state.query.search,
{
order_by: 'similarity',
},
expect.any(Function),
);
}); });
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment