Commit db6bb021 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '332889-use-similarity-sort-in-search-groups-dropdown' into 'master'

Sort by similarity in Search Group dropdown [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!64033
parents fc6d5c72 ba79e513
......@@ -6,7 +6,7 @@ import * as types from './mutation_types';
export const fetchGroups = ({ commit }, search) => {
commit(types.REQUEST_GROUPS);
Api.groups(search)
Api.groups(search, { order_by: 'similarity' })
.then((data) => {
commit(types.RECEIVE_GROUPS_SUCCESS, data);
})
......
......@@ -56,6 +56,19 @@ describe('Global Search Store Actions', () => {
});
});
describe('getGroupsData', () => {
const mockCommit = () => {};
beforeEach(() => {
jest.spyOn(Api, 'groups').mockResolvedValue(MOCK_GROUPS);
});
it('calls Api.groups with order_by set to similarity', () => {
actions.fetchGroups({ commit: mockCommit }, 'test');
expect(Api.groups).toHaveBeenCalledWith('test', { order_by: 'similarity' });
});
});
describe('getProjectsData', () => {
const mockCommit = () => {};
beforeEach(() => {
......
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