diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-16 21:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-16 21:09:24 +0300 |
commit | 1eec6b22b26d09ce6927adf66f98d755a6339815 (patch) | |
tree | b1bb8bbdc0d49136bfd176a1e64d3bd9f2969396 /spec/frontend_integration/test_helpers | |
parent | b4e854a900ba9bcbfc3476f88317c59ea048daaf (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend_integration/test_helpers')
4 files changed, 32 insertions, 0 deletions
diff --git a/spec/frontend_integration/test_helpers/fixtures.js b/spec/frontend_integration/test_helpers/fixtures.js index 4c0143534c5..b2768440607 100644 --- a/spec/frontend_integration/test_helpers/fixtures.js +++ b/spec/frontend_integration/test_helpers/fixtures.js @@ -31,6 +31,12 @@ export const getBranch = factory.json(() => export const getMergeRequests = factory.json(() => require('test_fixtures/api/merge_requests/get.json'), ); +export const getMergeRequestWithChanges = factory.json(() => + require('test_fixtures/api/merge_requests/changes.json'), +); +export const getMergeRequestVersions = factory.json(() => + require('test_fixtures/api/merge_requests/versions.json'), +); export const getRepositoryFiles = factory.json(() => require('test_fixtures/projects_json/files.json'), ); diff --git a/spec/frontend_integration/test_helpers/mock_server/index.js b/spec/frontend_integration/test_helpers/mock_server/index.js index 2aebdefaafb..20cb441daa7 100644 --- a/spec/frontend_integration/test_helpers/mock_server/index.js +++ b/spec/frontend_integration/test_helpers/mock_server/index.js @@ -4,6 +4,8 @@ import { getEmptyProject, getBranch, getMergeRequests, + getMergeRequestWithChanges, + getMergeRequestVersions, getRepositoryFiles, getBlobReadme, getBlobImage, @@ -16,6 +18,8 @@ export const createMockServerOptions = () => ({ project: Model, branch: Model, mergeRequest: Model, + mergeRequestChange: Model, + mergeRequestVersion: Model, file: Model, userPermission: Model, }, @@ -30,6 +34,8 @@ export const createMockServerOptions = () => ({ projects: [getProject(), getEmptyProject()], branches: [getBranch()], mergeRequests: getMergeRequests(), + mergeRequestChanges: [getMergeRequestWithChanges()], + mergeRequestVersions: getMergeRequestVersions(), filesRaw: [ { raw: getBlobReadme(), diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/404.js b/spec/frontend_integration/test_helpers/mock_server/routes/404.js index bc8edba927e..54183f1189c 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/404.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/404.js @@ -1,3 +1,5 @@ +import { Response } from 'miragejs'; + export default (server) => { ['get', 'post', 'put', 'delete', 'patch'].forEach((method) => { server[method]('*', () => { diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/projects.js b/spec/frontend_integration/test_helpers/mock_server/routes/projects.js index de37aa98eee..e6e09121fd4 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/projects.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/projects.js @@ -20,4 +20,22 @@ export default (server) => { return result.models; }); + + server.get('/api/v4/projects/:id/merge_requests/:mid', (schema, request) => { + const mr = schema.mergeRequests.findBy({ iid: request.params.mid }); + + return mr.attrs; + }); + + server.get('/api/v4/projects/:id/merge_requests/:mid/versions', (schema, request) => { + const versions = schema.mergeRequestVersions.where({ merge_request_id: request.params.mid }); + + return versions.models; + }); + + server.get('/api/v4/projects/:id/merge_requests/:mid/changes', (schema, request) => { + const mrWithChanges = schema.mergeRequestChanges.findBy({ iid: request.params.mid }); + + return mrWithChanges.attrs; + }); }; |