2021-09-30 23:02:18 +05:30
|
|
|
import { GROUPS_LOCAL_STORAGE_KEY, PROJECTS_LOCAL_STORAGE_KEY } from '~/search/store/constants';
|
|
|
|
import * as types from '~/search/store/mutation_types';
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
export const MOCK_QUERY = {
|
|
|
|
scope: 'issues',
|
|
|
|
state: 'all',
|
|
|
|
confidential: null,
|
2021-09-04 01:27:46 +05:30
|
|
|
group_id: 1,
|
2021-01-29 00:20:46 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const MOCK_GROUP = {
|
2021-09-30 23:02:18 +05:30
|
|
|
id: 1,
|
2021-01-29 00:20:46 +05:30
|
|
|
name: 'test group',
|
2021-09-04 01:27:46 +05:30
|
|
|
full_name: 'full name / test group',
|
2021-01-29 00:20:46 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const MOCK_GROUPS = [
|
|
|
|
{
|
2021-09-30 23:02:18 +05:30
|
|
|
id: 1,
|
2021-09-04 01:27:46 +05:30
|
|
|
avatar_url: null,
|
2021-01-29 00:20:46 +05:30
|
|
|
name: 'test group',
|
2021-09-04 01:27:46 +05:30
|
|
|
full_name: 'full name / test group',
|
2021-01-29 00:20:46 +05:30
|
|
|
},
|
|
|
|
{
|
2021-09-30 23:02:18 +05:30
|
|
|
id: 2,
|
2021-09-04 01:27:46 +05:30
|
|
|
avatar_url: 'https://avatar.com',
|
2021-01-29 00:20:46 +05:30
|
|
|
name: 'test group 2',
|
2021-09-04 01:27:46 +05:30
|
|
|
full_name: 'full name / test group 2',
|
2021-01-29 00:20:46 +05:30
|
|
|
},
|
|
|
|
];
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
export const MOCK_PROJECT = {
|
2021-09-30 23:02:18 +05:30
|
|
|
id: 1,
|
2021-02-22 17:27:13 +05:30
|
|
|
name: 'test project',
|
2021-03-11 19:13:27 +05:30
|
|
|
namespace: MOCK_GROUP,
|
2021-09-04 01:27:46 +05:30
|
|
|
nameWithNamespace: 'test group / test project',
|
2021-02-22 17:27:13 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const MOCK_PROJECTS = [
|
|
|
|
{
|
2021-09-30 23:02:18 +05:30
|
|
|
id: 1,
|
2021-02-22 17:27:13 +05:30
|
|
|
name: 'test project',
|
2021-03-11 19:13:27 +05:30
|
|
|
namespace: MOCK_GROUP,
|
2021-09-04 01:27:46 +05:30
|
|
|
name_with_namespace: 'test group / test project',
|
2021-02-22 17:27:13 +05:30
|
|
|
},
|
|
|
|
{
|
2021-09-30 23:02:18 +05:30
|
|
|
id: 2,
|
2021-02-22 17:27:13 +05:30
|
|
|
name: 'test project 2',
|
2021-03-11 19:13:27 +05:30
|
|
|
namespace: MOCK_GROUP,
|
2021-09-04 01:27:46 +05:30
|
|
|
name_with_namespace: 'test group / test project 2',
|
2021-02-22 17:27:13 +05:30
|
|
|
},
|
|
|
|
];
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
export const MOCK_SORT_OPTIONS = [
|
|
|
|
{
|
|
|
|
title: 'Most relevant',
|
|
|
|
sortable: false,
|
|
|
|
sortParam: 'relevant',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Created date',
|
|
|
|
sortable: true,
|
|
|
|
sortParam: {
|
|
|
|
asc: 'created_asc',
|
|
|
|
desc: 'created_desc',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
2021-09-30 23:02:18 +05:30
|
|
|
|
|
|
|
export const MOCK_LS_KEY = 'mock-ls-key';
|
|
|
|
|
|
|
|
export const MOCK_INFLATED_DATA = [
|
|
|
|
{ id: 1, name: 'test 1' },
|
|
|
|
{ id: 2, name: 'test 2' },
|
|
|
|
];
|
|
|
|
|
|
|
|
export const FRESH_STORED_DATA = [
|
|
|
|
{ id: 1, name: 'test 1', frequency: 1 },
|
|
|
|
{ id: 2, name: 'test 2', frequency: 2 },
|
|
|
|
];
|
|
|
|
|
|
|
|
export const STALE_STORED_DATA = [
|
|
|
|
{ id: 1, name: 'blah 1', frequency: 1 },
|
|
|
|
{ id: 2, name: 'blah 2', frequency: 2 },
|
|
|
|
];
|
|
|
|
|
|
|
|
export const MOCK_FRESH_DATA_RES = { name: 'fresh' };
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
export const PRELOAD_EXPECTED_MUTATIONS = [
|
|
|
|
{
|
2021-09-30 23:02:18 +05:30
|
|
|
type: types.LOAD_FREQUENT_ITEMS,
|
|
|
|
payload: { key: GROUPS_LOCAL_STORAGE_KEY, data: FRESH_STORED_DATA },
|
|
|
|
},
|
2021-10-27 15:23:28 +05:30
|
|
|
{
|
2021-09-30 23:02:18 +05:30
|
|
|
type: types.LOAD_FREQUENT_ITEMS,
|
2021-10-27 15:23:28 +05:30
|
|
|
payload: { key: PROJECTS_LOCAL_STORAGE_KEY, data: FRESH_STORED_DATA },
|
2021-09-30 23:02:18 +05:30
|
|
|
},
|
2021-10-27 15:23:28 +05:30
|
|
|
];
|
|
|
|
|
|
|
|
export const PROMISE_ALL_EXPECTED_MUTATIONS = {
|
|
|
|
resGroups: {
|
2021-09-30 23:02:18 +05:30
|
|
|
type: types.LOAD_FREQUENT_ITEMS,
|
2021-10-27 15:23:28 +05:30
|
|
|
payload: { key: GROUPS_LOCAL_STORAGE_KEY, data: [MOCK_FRESH_DATA_RES, MOCK_FRESH_DATA_RES] },
|
2021-09-30 23:02:18 +05:30
|
|
|
},
|
|
|
|
resProjects: {
|
|
|
|
type: types.LOAD_FREQUENT_ITEMS,
|
|
|
|
payload: { key: PROJECTS_LOCAL_STORAGE_KEY, data: [MOCK_FRESH_DATA_RES, MOCK_FRESH_DATA_RES] },
|
|
|
|
},
|
|
|
|
};
|
2023-01-13 00:05:48 +05:30
|
|
|
|
|
|
|
export const MOCK_NAVIGATION = {
|
|
|
|
projects: {
|
|
|
|
label: 'Projects',
|
|
|
|
scope: 'projects',
|
|
|
|
link: '/search?scope=projects&search=et',
|
|
|
|
count_link: '/search/count?scope=projects&search=et',
|
|
|
|
},
|
|
|
|
blobs: {
|
|
|
|
label: 'Code',
|
|
|
|
scope: 'blobs',
|
|
|
|
link: '/search?scope=blobs&search=et',
|
|
|
|
count_link: '/search/count?scope=blobs&search=et',
|
|
|
|
},
|
|
|
|
issues: {
|
|
|
|
label: 'Issues',
|
|
|
|
scope: 'issues',
|
|
|
|
link: '/search?scope=issues&search=et',
|
|
|
|
active: true,
|
|
|
|
count: '2,430',
|
|
|
|
},
|
|
|
|
merge_requests: {
|
|
|
|
label: 'Merge requests',
|
|
|
|
scope: 'merge_requests',
|
|
|
|
link: '/search?scope=merge_requests&search=et',
|
|
|
|
count_link: '/search/count?scope=merge_requests&search=et',
|
|
|
|
},
|
|
|
|
wiki_blobs: {
|
|
|
|
label: 'Wiki',
|
|
|
|
scope: 'wiki_blobs',
|
|
|
|
link: '/search?scope=wiki_blobs&search=et',
|
|
|
|
count_link: '/search/count?scope=wiki_blobs&search=et',
|
|
|
|
},
|
|
|
|
commits: {
|
|
|
|
label: 'Commits',
|
|
|
|
scope: 'commits',
|
|
|
|
link: '/search?scope=commits&search=et',
|
|
|
|
count_link: '/search/count?scope=commits&search=et',
|
|
|
|
},
|
|
|
|
notes: {
|
|
|
|
label: 'Comments',
|
|
|
|
scope: 'notes',
|
|
|
|
link: '/search?scope=notes&search=et',
|
|
|
|
count_link: '/search/count?scope=notes&search=et',
|
|
|
|
},
|
|
|
|
milestones: {
|
|
|
|
label: 'Milestones',
|
|
|
|
scope: 'milestones',
|
|
|
|
link: '/search?scope=milestones&search=et',
|
|
|
|
count_link: '/search/count?scope=milestones&search=et',
|
|
|
|
},
|
|
|
|
users: {
|
|
|
|
label: 'Users',
|
|
|
|
scope: 'users',
|
|
|
|
link: '/search?scope=users&search=et',
|
|
|
|
count_link: '/search/count?scope=users&search=et',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const MOCK_NAVIGATION_DATA = {
|
|
|
|
projects: {
|
|
|
|
label: 'Projects',
|
|
|
|
scope: 'projects',
|
|
|
|
link: '/search?scope=projects&search=et',
|
|
|
|
count_link: '/search/count?scope=projects&search=et',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const MOCK_ENDPOINT_RESPONSE = { count: '13' };
|
|
|
|
|
|
|
|
export const MOCK_DATA_FOR_NAVIGATION_ACTION_MUTATION = {
|
|
|
|
projects: {
|
|
|
|
count: '13',
|
|
|
|
label: 'Projects',
|
|
|
|
scope: 'projects',
|
|
|
|
link: '/search?scope=projects&search=et',
|
|
|
|
count_link: '/search/count?scope=projects&search=et',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const MOCK_NAVIGATION_ACTION_MUTATION = {
|
|
|
|
type: types.RECEIVE_NAVIGATION_COUNT,
|
|
|
|
payload: { key: 'projects', count: '13' },
|
|
|
|
};
|