diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-13 21:11:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-13 21:11:28 +0300 |
commit | a5605d87fb839e0b1015ad9e736c44fbb2ada202 (patch) | |
tree | 9717afb7cc7d663de6bda5d78c651aafb73a16a3 /spec/frontend_integration/test_helpers | |
parent | 536d72ba7ea2226b56ddc55a3eb35c96a9ba3b6d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend_integration/test_helpers')
3 files changed, 29 insertions, 0 deletions
diff --git a/spec/frontend_integration/test_helpers/fixtures.js b/spec/frontend_integration/test_helpers/fixtures.js index b2768440607..5673e36197f 100644 --- a/spec/frontend_integration/test_helpers/fixtures.js +++ b/spec/frontend_integration/test_helpers/fixtures.js @@ -40,6 +40,12 @@ export const getMergeRequestVersions = factory.json(() => export const getRepositoryFiles = factory.json(() => require('test_fixtures/projects_json/files.json'), ); +export const getDiffsMetadata = factory.json(() => + require('test_fixtures/merge_request_diffs/diffs_metadata.json'), +); +export const getDiffsBatch = factory.json(() => + require('test_fixtures/merge_request_diffs/diffs_batch.json'), +); export const getPipelinesEmptyResponse = factory.json(() => require('test_fixtures/projects_json/pipelines_empty.json'), ); diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/diffs.js b/spec/frontend_integration/test_helpers/mock_server/routes/diffs.js new file mode 100644 index 00000000000..8301627e842 --- /dev/null +++ b/spec/frontend_integration/test_helpers/mock_server/routes/diffs.js @@ -0,0 +1,22 @@ +import { getDiffsMetadata, getDiffsBatch } from 'test_helpers/fixtures'; +import { withValues } from 'test_helpers/utils/obj'; + +export default (server) => { + server.get('/:namespace/:project/-/merge_requests/:mrid/diffs_metadata.json', () => { + return getDiffsMetadata(); + }); + + server.get('/:namespace/:project/-/merge_requests/:mrid/diffs_batch.json', () => { + const { pagination, ...result } = getDiffsBatch(); + + return { + ...result, + pagination: withValues(pagination, { + current_page: null, + next_page: null, + total_pages: 1, + next_page_href: null, + }), + }; + }); +}; diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/index.js b/spec/frontend_integration/test_helpers/mock_server/routes/index.js index e30fecf2f06..48eff2702dd 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/index.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/index.js @@ -5,6 +5,7 @@ export default (server) => { require('./projects'), require('./repository'), require('./ci'), + require('./diffs'), require('./404'), ].forEach(({ default: setup }) => { setup(server); |