debian-mirror-gitlab/spec/frontend/repository/mock_data.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

201 lines
5.5 KiB
JavaScript
Raw Normal View History

2021-12-11 22:18:48 +05:30
export const simpleViewerMock = {
2022-10-11 01:57:18 +05:30
__typename: 'RepositoryBlob',
2022-01-26 12:08:38 +05:30
id: '1',
2021-12-11 22:18:48 +05:30
name: 'some_file.js',
size: 123,
rawSize: 123,
rawTextBlob: 'raw content',
fileType: 'text',
2022-04-04 11:22:00 +05:30
language: 'javascript',
2021-12-11 22:18:48 +05:30
path: 'some_file.js',
webPath: 'some_file.js',
2022-08-27 11:52:29 +05:30
blamePath: 'blame/file.js',
2021-12-11 22:18:48 +05:30
editBlobPath: 'some_file.js/edit',
2022-05-07 20:08:51 +05:30
gitpodBlobUrl: 'https://gitpod.io#path/to/blob.js',
2021-12-11 22:18:48 +05:30
ideEditPath: 'some_file.js/ide/edit',
forkAndEditPath: 'some_file.js/fork/edit',
ideForkAndEditPath: 'some_file.js/fork/ide',
2022-05-07 20:08:51 +05:30
forkAndViewPath: 'some_file.js/fork/view',
codeNavigationPath: '',
projectBlobPathRoot: '',
2022-04-04 11:22:00 +05:30
environmentFormattedExternalUrl: '',
environmentExternalUrlForRouteMap: '',
2021-12-11 22:18:48 +05:30
canModifyBlob: true,
2022-01-26 12:08:38 +05:30
canCurrentUserPushToBranch: true,
2022-03-02 08:16:31 +05:30
archived: false,
2021-12-11 22:18:48 +05:30
storedExternally: false,
2022-04-04 11:22:00 +05:30
externalStorageUrl: '',
2022-03-02 08:16:31 +05:30
externalStorage: 'lfs',
2021-12-11 22:18:48 +05:30
rawPath: 'some_file.js',
replacePath: 'some_file.js/replace',
2022-05-07 20:08:51 +05:30
pipelineEditorPath: 'path/to/pipeline/editor',
2021-12-11 22:18:48 +05:30
simpleViewer: {
fileType: 'text',
tooLarge: false,
type: 'simple',
renderError: null,
},
richViewer: null,
};
export const richViewerMock = {
...simpleViewerMock,
richViewer: {
fileType: 'markup',
tooLarge: false,
type: 'rich',
renderError: null,
},
};
export const userPermissionsMock = {
pushCode: true,
forkProject: true,
downloadCode: true,
createMergeRequestIn: true,
};
export const projectMock = {
2022-04-04 11:22:00 +05:30
__typename: 'Project',
2021-12-11 22:18:48 +05:30
id: '1234',
userPermissions: userPermissionsMock,
pathLocks: {
2022-01-26 12:08:38 +05:30
nodes: [
{
id: 'test',
2022-03-02 08:16:31 +05:30
path: 'locked_file.js',
2022-01-26 12:08:38 +05:30
user: { id: '123', username: 'root' },
},
],
2021-12-11 22:18:48 +05:30
},
repository: {
empty: false,
},
};
2022-05-07 20:08:51 +05:30
export const userInfoMock = {
currentUser: {
id: '123',
gitpodEnabled: true,
preferencesGitpodPath: '/-/profile/preferences#user_gitpod_enabled',
profileEnableGitpodPath: '/-/profile?user%5Bgitpod_enabled%5D=true',
},
};
export const applicationInfoMock = { gitpodEnabled: true };
2021-12-11 22:18:48 +05:30
export const propsMock = { path: 'some_file.js', projectPath: 'some/path' };
export const refMock = 'default-ref';
2023-03-17 16:20:25 +05:30
export const refWithSpecialCharMock = 'feat/selected-#-ref-#';
export const encodedRefWithSpecialCharMock = 'feat/selected-%23-ref-%23';
2022-03-02 08:16:31 +05:30
export const blobControlsDataMock = {
id: '1234',
repository: {
blobs: {
nodes: [
{
id: '5678',
findFilePath: 'find/file.js',
blamePath: 'blame/file.js',
historyPath: 'history/file.js',
permalinkPath: 'permalink/file.js',
storedExternally: false,
externalStorage: '',
},
],
},
},
};
2023-03-17 16:20:25 +05:30
export const graphQLErrors = [
{
message: '14:failed to connect to all addresses.',
locations: [{ line: 16, column: 7 }],
path: ['project', 'repository', 'paginatedTree'],
extensions: { code: 'unavailable', gitaly_code: 14, service: 'git' },
},
];
export const propsForkInfo = {
projectPath: 'nataliia/myGitLab',
2023-04-23 21:23:45 +05:30
selectedBranch: 'main',
2023-03-17 16:20:25 +05:30
sourceName: 'gitLab',
sourcePath: 'gitlab-org/gitlab',
2023-06-20 00:43:36 +05:30
canSyncBranch: true,
2023-04-23 21:23:45 +05:30
aheadComparePath: '/nataliia/myGitLab/-/compare/main...ref?from_project_id=1',
behindComparePath: 'gitlab-org/gitlab/-/compare/ref...main?from_project_id=2',
2023-06-20 00:43:36 +05:30
createMrPath: 'path/to/new/mr',
2023-03-17 16:20:25 +05:30
};
2023-05-27 22:25:52 +05:30
export const propsConflictsModal = {
sourceDefaultBranch: 'branch-name',
sourceName: 'source-name',
sourcePath: 'path/to/project',
2023-06-20 00:43:36 +05:30
selectedBranch: 'my-branch',
2023-05-27 22:25:52 +05:30
};
2023-07-09 08:55:56 +05:30
export const paginatedTreeResponseFactory = ({
numberOfBlobs = 3,
numberOfTrees = 3,
hasNextPage = false,
blobHasReadme = false,
} = {}) => ({
data: {
project: {
id: 'gid://gitlab/Project/278964',
__typename: 'Project',
repository: {
__typename: 'Repository',
paginatedTree: {
__typename: 'TreeConnection',
pageInfo: {
__typename: 'PageInfo',
endCursor: hasNextPage ? 'aaa' : '',
startCursor: '',
hasNextPage,
},
nodes: [
{
__typename: 'Tree',
trees: {
__typename: 'TreeEntryConnection',
nodes: new Array(numberOfTrees).fill({
__typename: 'TreeEntry',
id:
'gid://gitlab/Gitlab::Graphql::Representation::TreeEntry/dc36320ac91aca2f890a31458c9e9920159e68a3',
sha: 'dc36320ac91aca2f890a31458c9e9920159e68ae',
name: 'gitlab-resize-image',
flatPath: 'workhorse/cmd/gitlab-resize-image',
type: 'tree',
webPath: '/gitlab-org/gitlab/-/tree/master/workhorse/cmd/gitlab-resize-image',
}),
},
submodules: {
__typename: 'SubmoduleConnection',
nodes: [],
},
blobs: {
__typename: 'BlobConnection',
nodes: new Array(numberOfBlobs).fill({
__typename: 'Blob',
id:
'gid://gitlab/Gitlab::Graphql::Representation::TreeEntry/99712dbc6b26ff92c15bf93449ea09df38adfb10',
sha: '99712dbc6b26ff92c15bf93449ea09df38adfb1b',
name: blobHasReadme ? 'README.md' : 'fakeBlob',
flatPath: blobHasReadme ? 'README.md' : 'fakeBlob',
type: 'blob',
mode: '100644',
webPath: '/gitlab-org/gitlab-build-images/-/blob/master/README.md',
lfsOid: null,
}),
},
},
],
},
},
},
},
});