Commit ba79e513 authored by Terri Chu's avatar Terri Chu Committed by Ezekiel Kigbo

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

parent 11f820a1
......@@ -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