Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e0e316fc
Commit
e0e316fc
authored
Mar 15, 2021
by
Dave Pisek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mock-server setup
* Adds settings to jest-config * Adds mockdata and routes
parent
57b5517b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
45 deletions
+55
-45
ee/spec/frontend_integration/test_helpers/mock_data/vulnerabilities_mock_data.js
...ation/test_helpers/mock_data/vulnerabilities_mock_data.js
+36
-0
ee/spec/frontend_integration/test_helpers/mock_server/routes/index.js
...tend_integration/test_helpers/mock_server/routes/index.js
+10
-0
ee/spec/frontend_integration/test_helpers/mock_server/routes/vulnerabilities.js
...ration/test_helpers/mock_server/routes/vulnerabilities.js
+5
-0
ee/spec/frontend_integration/vulnerabilities/mock_data.js
ee/spec/frontend_integration/vulnerabilities/mock_data.js
+0
-37
ee/spec/frontend_integration/vulnerabilities/mock_routes.js
ee/spec/frontend_integration/vulnerabilities/mock_routes.js
+0
-5
jest.config.base.js
jest.config.base.js
+3
-1
spec/frontend_integration/test_helpers/mock_server/index.js
spec/frontend_integration/test_helpers/mock_server/index.js
+1
-1
spec/frontend_integration/test_helpers/setup/index.js
spec/frontend_integration/test_helpers/setup/index.js
+0
-1
No files found.
ee/spec/frontend_integration/test_helpers/mock_data/vulnerabilities_mock_data.js
0 → 100644
View file @
e0e316fc
export
const
mockIssueLink
=
{
assignee
:
null
,
assignees
:
[],
author
:
{
id
:
1
,
name
:
'
Administrator
'
,
username
:
'
container
'
,
state
:
'
active
'
},
blocking_issues_count
:
0
,
closed_at
:
null
,
closed_by
:
null
,
confidential
:
true
,
created_at
:
'
2021-01-10T23:17:23.385Z
'
,
description
:
'
description
'
,
discussion_locked
:
null
,
downvotes
:
0
,
due_date
:
null
,
id
:
501
,
iid
:
12
,
labels
:
[],
merge_requests_count
:
0
,
milestone
:
null
,
project_id
:
23
,
state
:
'
opened
'
,
task_completion_status
:
{
count
:
0
,
completed_count
:
0
},
time_stats
:
{
time_estimate
:
0
,
total_time_spent
:
0
,
human_time_estimate
:
null
,
human_total_time_spent
:
null
,
},
title
:
'
Investigate vulnerability: Improper Input Validation in xterm
'
,
updated_at
:
'
2021-01-10T23:17:23.385Z
'
,
upvotes
:
0
,
user_notes_count
:
0
,
vulnerability_link_id
:
53
,
vulnerability_link_type
:
'
created
'
,
web_url
:
'
http://gdk.test:3000/security-reports/dependency-list-test/-/issues/12
'
,
weight
:
null
,
};
ee/spec/frontend_integration/test_helpers/mock_server/routes/index.js
0 → 100644
View file @
e0e316fc
import
defaultRoutes
from
'
test_helpers/mock_server/routes
'
;
/* eslint-disable global-require */
export
default
(
server
)
=>
{
[
require
(
'
./vulnerabilities
'
)].
forEach
(({
default
:
setup
})
=>
{
setup
(
server
);
});
defaultRoutes
(
server
);
};
ee/spec/frontend_integration/test_helpers/mock_server/routes/vulnerabilities.js
0 → 100644
View file @
e0e316fc
import
{
mockIssueLink
}
from
'
../../mock_data/vulnerabilities_mock_data
'
;
export
default
(
server
)
=>
{
server
.
get
(
'
/api/v4/vulnerabilities/:id/issue_links
'
,
()
=>
[
mockIssueLink
]);
};
ee/spec/frontend_integration/vulnerabilities/mock_data.js
View file @
e0e316fc
...
...
@@ -13,40 +13,3 @@ export const mockVulnerability = {
full_path
:
'
/project_full_path
'
,
},
};
export
const
mockIssueLink
=
{
assignee
:
null
,
assignees
:
[],
author
:
{
id
:
1
,
name
:
'
Administrator
'
,
username
:
'
container
'
,
state
:
'
active
'
},
blocking_issues_count
:
0
,
closed_at
:
null
,
closed_by
:
null
,
confidential
:
true
,
created_at
:
'
2021-01-10T23:17:23.385Z
'
,
description
:
'
description
'
,
discussion_locked
:
null
,
downvotes
:
0
,
due_date
:
null
,
id
:
501
,
iid
:
12
,
labels
:
[],
merge_requests_count
:
0
,
milestone
:
null
,
project_id
:
23
,
state
:
'
opened
'
,
task_completion_status
:
{
count
:
0
,
completed_count
:
0
},
time_stats
:
{
time_estimate
:
0
,
total_time_spent
:
0
,
human_time_estimate
:
null
,
human_total_time_spent
:
null
,
},
title
:
'
Investigate vulnerability: Improper Input Validation in xterm
'
,
updated_at
:
'
2021-01-10T23:17:23.385Z
'
,
upvotes
:
0
,
user_notes_count
:
0
,
vulnerability_link_id
:
53
,
vulnerability_link_type
:
'
created
'
,
web_url
:
'
http://gdk.test:3000/security-reports/dependency-list-test/-/issues/12
'
,
weight
:
null
,
};
ee/spec/frontend_integration/vulnerabilities/mock_routes.js
deleted
100644 → 0
View file @
57b5517b
import
{
mockIssueLink
}
from
'
./mock_data
'
;
export
const
createIssueLinksRoute
=
()
=>
{
mockServer
.
get
(
'
/api/v4/vulnerabilities/:id/issue_links
'
,
()
=>
[
mockIssueLink
]);
};
jest.config.base.js
View file @
e0e316fc
...
...
@@ -45,7 +45,8 @@ module.exports = (path) => {
'
emojis(/.*).json
'
:
'
<rootDir>/fixtures/emojis$1.json
'
,
'
^spec/test_constants$
'
:
'
<rootDir>/spec/frontend/__helpers__/test_constants
'
,
'
^jest/(.*)$
'
:
'
<rootDir>/spec/frontend/$1
'
,
'
test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
'
^test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
'
^ee_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
};
const
collectCoverageFrom
=
[
'
<rootDir>/app/assets/javascripts/**/*.{js,vue}
'
];
...
...
@@ -56,6 +57,7 @@ module.exports = (path) => {
'
^ee(/.*)$
'
:
rootDirEE
,
'
^ee_component(/.*)$
'
:
rootDirEE
,
'
^ee_else_ce(/.*)$
'
:
rootDirEE
,
'
^ee_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/ee/spec/frontend_integration/test_helpers$1
'
,
'
^ee_jest/(.*)$
'
:
'
<rootDir>/ee/spec/frontend/$1
'
,
[
TEST_FIXTURES_PATTERN
]:
'
<rootDir>/tmp/tests/frontend/fixtures-ee$1
'
,
});
...
...
spec/frontend_integration/test_helpers/mock_server/index.js
View file @
e0e316fc
import
{
Server
,
Model
,
RestSerializer
}
from
'
miragejs
'
;
import
setupRoutes
from
'
ee_else_ce_test_helpers/mock_server/routes
'
;
import
{
getProject
,
getEmptyProject
,
...
...
@@ -11,7 +12,6 @@ import {
getBlobImage
,
getBlobZip
,
}
from
'
test_helpers/fixtures
'
;
import
setupRoutes
from
'
./routes
'
;
export
const
createMockServerOptions
=
()
=>
({
models
:
{
...
...
spec/frontend_integration/test_helpers/setup/index.js
View file @
e0e316fc
...
...
@@ -4,4 +4,3 @@ import './setup_axios';
import
'
./setup_serializers
'
;
import
'
./setup_mock_server
'
;
import
'
./setup_testing_library
'
;
import
'
./setup_jest_dom
'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment