diff options
Diffstat (limited to 'spec/frontend/runner/mock_data.js')
-rw-r--r-- | spec/frontend/runner/mock_data.js | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/spec/frontend/runner/mock_data.js b/spec/frontend/runner/mock_data.js index e5472ace817..555ec40184f 100644 --- a/spec/frontend/runner/mock_data.js +++ b/spec/frontend/runner/mock_data.js @@ -19,6 +19,14 @@ import groupRunnersCountData from 'test_fixtures/graphql/runner/list/group_runne import { RUNNER_PAGE_SIZE } from '~/runner/constants'; +const emptyPageInfo = { + __typename: 'PageInfo', + hasNextPage: false, + hasPreviousPage: false, + startCursor: '', + endCursor: '', +}; + // Other mock data // Mock searches and their corresponding urls @@ -26,7 +34,7 @@ export const mockSearchExamples = [ { name: 'a default query', urlQuery: '', - search: { runnerType: null, filters: [], pagination: { page: 1 }, sort: 'CREATED_DESC' }, + search: { runnerType: null, filters: [], pagination: {}, sort: 'CREATED_DESC' }, graphqlVariables: { sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, isDefault: true, }, @@ -36,7 +44,7 @@ export const mockSearchExamples = [ search: { runnerType: null, filters: [{ type: 'status', value: { data: 'ACTIVE', operator: '=' } }], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { status: 'ACTIVE', sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -52,7 +60,7 @@ export const mockSearchExamples = [ value: { data: 'something' }, }, ], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { search: 'something', sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -72,7 +80,7 @@ export const mockSearchExamples = [ value: { data: 'else' }, }, ], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { search: 'something else', sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -83,7 +91,7 @@ export const mockSearchExamples = [ search: { runnerType: 'INSTANCE_TYPE', filters: [], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { type: 'INSTANCE_TYPE', sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -97,7 +105,7 @@ export const mockSearchExamples = [ { type: 'status', value: { data: 'ACTIVE', operator: '=' } }, { type: 'status', value: { data: 'PAUSED', operator: '=' } }, ], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { status: 'ACTIVE', sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -108,7 +116,7 @@ export const mockSearchExamples = [ search: { runnerType: 'INSTANCE_TYPE', filters: [{ type: 'status', value: { data: 'ACTIVE', operator: '=' } }], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_ASC', }, graphqlVariables: { @@ -124,7 +132,7 @@ export const mockSearchExamples = [ search: { runnerType: null, filters: [{ type: 'tag', value: { data: 'tag-1', operator: '=' } }], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { @@ -142,7 +150,7 @@ export const mockSearchExamples = [ { type: 'tag', value: { data: 'tag-1', operator: '=' } }, { type: 'tag', value: { data: 'tag-2', operator: '=' } }, ], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { @@ -153,22 +161,22 @@ export const mockSearchExamples = [ }, { name: 'the next page', - urlQuery: '?page=2&after=AFTER_CURSOR', + urlQuery: '?after=AFTER_CURSOR', search: { runnerType: null, filters: [], - pagination: { page: 2, after: 'AFTER_CURSOR' }, + pagination: { after: 'AFTER_CURSOR' }, sort: 'CREATED_DESC', }, graphqlVariables: { sort: 'CREATED_DESC', after: 'AFTER_CURSOR', first: RUNNER_PAGE_SIZE }, }, { name: 'the previous page', - urlQuery: '?page=2&before=BEFORE_CURSOR', + urlQuery: '?before=BEFORE_CURSOR', search: { runnerType: null, filters: [], - pagination: { page: 2, before: 'BEFORE_CURSOR' }, + pagination: { before: 'BEFORE_CURSOR' }, sort: 'CREATED_DESC', }, graphqlVariables: { sort: 'CREATED_DESC', before: 'BEFORE_CURSOR', last: RUNNER_PAGE_SIZE }, @@ -176,7 +184,7 @@ export const mockSearchExamples = [ { name: 'the next page filtered by a status, an instance type, tags and a non default sort', urlQuery: - '?status[]=ACTIVE&runner_type[]=INSTANCE_TYPE&tag[]=tag-1&tag[]=tag-2&sort=CREATED_ASC&page=2&after=AFTER_CURSOR', + '?status[]=ACTIVE&runner_type[]=INSTANCE_TYPE&tag[]=tag-1&tag[]=tag-2&sort=CREATED_ASC&after=AFTER_CURSOR', search: { runnerType: 'INSTANCE_TYPE', filters: [ @@ -184,7 +192,7 @@ export const mockSearchExamples = [ { type: 'tag', value: { data: 'tag-1', operator: '=' } }, { type: 'tag', value: { data: 'tag-2', operator: '=' } }, ], - pagination: { page: 2, after: 'AFTER_CURSOR' }, + pagination: { after: 'AFTER_CURSOR' }, sort: 'CREATED_ASC', }, graphqlVariables: { @@ -202,7 +210,7 @@ export const mockSearchExamples = [ search: { runnerType: null, filters: [{ type: 'paused', value: { data: 'true', operator: '=' } }], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { paused: true, sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -213,7 +221,7 @@ export const mockSearchExamples = [ search: { runnerType: null, filters: [{ type: 'paused', value: { data: 'false', operator: '=' } }], - pagination: { page: 1 }, + pagination: {}, sort: 'CREATED_DESC', }, graphqlVariables: { paused: false, sort: 'CREATED_DESC', first: RUNNER_PAGE_SIZE }, @@ -233,6 +241,7 @@ export { groupRunnersData, groupRunnersDataPaginated, groupRunnersCountData, + emptyPageInfo, runnerData, runnerWithGroupData, runnerProjectsData, |