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
06f5f500
Commit
06f5f500
authored
Oct 08, 2021
by
Albert Salim
Committed by
Mike Greiling
Oct 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use import for json fixture - 1/7
parent
95862f8c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
26 deletions
+22
-26
spec/frontend/gfm_auto_complete_spec.js
spec/frontend/gfm_auto_complete_spec.js
+1
-3
spec/frontend/ref/components/ref_selector_spec.js
spec/frontend/ref/components/ref_selector_spec.js
+4
-7
spec/frontend/related_merge_requests/components/related_merge_requests_spec.js
..._merge_requests/components/related_merge_requests_spec.js
+1
-5
spec/frontend/runner/mock_data.js
spec/frontend/runner/mock_data.js
+13
-9
spec/frontend/users_select/test_helper.js
spec/frontend/users_select/test_helper.js
+3
-2
No files found.
spec/frontend/gfm_auto_complete_spec.js
View file @
06f5f500
/* eslint no-param-reassign: "off" */
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
$
from
'
jquery
'
;
import
labelsFixture
from
'
test_fixtures/autocomplete_sources/labels.json
'
;
import
GfmAutoComplete
,
{
membersBeforeSave
}
from
'
ee_else_ce/gfm_auto_complete
'
;
import
{
initEmojiMock
}
from
'
helpers/emoji
'
;
import
'
~/lib/utils/jquery_at_who
'
;
import
{
getJSONFixture
}
from
'
helpers/fixtures
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
AjaxCache
from
'
~/lib/utils/ajax_cache
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
const
labelsFixture
=
getJSONFixture
(
'
autocomplete_sources/labels.json
'
);
describe
(
'
GfmAutoComplete
'
,
()
=>
{
const
fetchDataMock
=
{
fetchData
:
jest
.
fn
()
};
let
gfmAutoCompleteCallbacks
=
GfmAutoComplete
.
prototype
.
getDefaultCallbacks
.
call
(
fetchDataMock
);
...
...
spec/frontend/ref/components/ref_selector_spec.js
View file @
06f5f500
...
...
@@ -4,6 +4,9 @@ import axios from 'axios';
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
merge
,
last
}
from
'
lodash
'
;
import
Vuex
from
'
vuex
'
;
import
commit
from
'
test_fixtures/api/commits/commit.json
'
;
import
branches
from
'
test_fixtures/api/branches/branches.json
'
;
import
tags
from
'
test_fixtures/api/tags/tags.json
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
{
ENTER_KEY
}
from
'
~/lib/utils/keys
'
;
import
{
sprintf
}
from
'
~/locale
'
;
...
...
@@ -21,11 +24,7 @@ const localVue = createLocalVue();
localVue
.
use
(
Vuex
);
describe
(
'
Ref selector component
'
,
()
=>
{
const
fixtures
=
{
branches
:
getJSONFixture
(
'
api/branches/branches.json
'
),
tags
:
getJSONFixture
(
'
api/tags/tags.json
'
),
commit
:
getJSONFixture
(
'
api/commits/commit.json
'
),
};
const
fixtures
=
{
branches
,
tags
,
commit
};
const
projectId
=
'
8
'
;
...
...
@@ -480,8 +479,6 @@ describe('Ref selector component', () => {
it
(
'
renders each commit as a selectable item with the short SHA and commit title
'
,
()
=>
{
const
dropdownItems
=
findCommitDropdownItems
();
const
{
commit
}
=
fixtures
;
expect
(
dropdownItems
.
at
(
0
).
text
()).
toBe
(
`
${
commit
.
short_id
}
${
commit
.
title
}
`
);
});
});
...
...
spec/frontend/related_merge_requests/components/related_merge_requests_spec.js
View file @
06f5f500
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
mockData
from
'
test_fixtures/issues/related_merge_requests.json
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
RelatedMergeRequests
from
'
~/related_merge_requests/components/related_merge_requests.vue
'
;
import
createStore
from
'
~/related_merge_requests/store/index
'
;
import
RelatedIssuableItem
from
'
~/vue_shared/components/issue/related_issuable_item.vue
'
;
const
FIXTURE_PATH
=
'
issues/related_merge_requests.json
'
;
const
API_ENDPOINT
=
'
/api/v4/projects/2/issues/33/related_merge_requests
'
;
const
localVue
=
createLocalVue
();
describe
(
'
RelatedMergeRequests
'
,
()
=>
{
let
wrapper
;
let
mock
;
let
mockData
;
beforeEach
((
done
)
=>
{
loadFixtures
(
FIXTURE_PATH
);
mockData
=
getJSONFixture
(
FIXTURE_PATH
);
// put the fixture in DOM as the component expects
document
.
body
.
innerHTML
=
`<div id="js-issuable-app"></div>`
;
document
.
getElementById
(
'
js-issuable-app
'
).
dataset
.
initial
=
JSON
.
stringify
(
mockData
);
...
...
spec/frontend/runner/mock_data.js
View file @
06f5f500
const
runnerFixture
=
(
filename
)
=>
getJSONFixture
(
`graphql/runner/
${
filename
}
`
);
// Fixtures generated by: spec/frontend/fixtures/runner.rb
// Admin queries
export
const
runnersData
=
runnerFixture
(
'
get_runners.query.graphql.json
'
)
;
export
const
runnersDataPaginated
=
runnerFixture
(
'
get_runners.query.graphql.paginated.json
'
)
;
export
const
runnerData
=
runnerFixture
(
'
get_runner.query.graphql.json
'
)
;
import
runnersData
from
'
test_fixtures/graphql/runner/get_runners.query.graphql.json
'
;
import
runnersDataPaginated
from
'
test_fixtures/graphql/runner/get_runners.query.graphql.paginated.json
'
;
import
runnerData
from
'
test_fixtures/graphql/runner/get_runner.query.graphql.json
'
;
// Group queries
export
const
groupRunnersData
=
runnerFixture
(
'
get_group_runners.query.graphql.json
'
);
export
const
groupRunnersDataPaginated
=
runnerFixture
(
'
get_group_runners.query.graphql.paginated.json
'
,
);
import
groupRunnersData
from
'
test_fixtures/graphql/runner/get_group_runners.query.graphql.json
'
;
import
groupRunnersDataPaginated
from
'
test_fixtures/graphql/runner/get_group_runners.query.graphql.paginated.json
'
;
export
{
runnerData
,
runnersDataPaginated
,
runnersData
,
groupRunnersData
,
groupRunnersDataPaginated
,
};
spec/frontend/users_select/test_helper.js
View file @
06f5f500
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
memoize
,
cloneDeep
}
from
'
lodash
'
;
import
{
getFixture
,
getJSONFixture
}
from
'
helpers/fixtures
'
;
import
usersFixture
from
'
test_fixtures/autocomplete/users.json
'
;
import
{
getFixture
}
from
'
helpers/fixtures
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
UsersSelect
from
'
~/users_select
'
;
...
...
@@ -15,7 +16,7 @@ const getUserSearchHTML = memoize((fixturePath) => {
return
el
.
outerHTML
;
});
const
getUsersFixture
=
memoize
(()
=>
getJSONFixture
(
'
autocomplete/users.json
'
))
;
const
getUsersFixture
=
()
=>
usersFixture
;
export
const
getUsersFixtureAt
=
(
idx
)
=>
getUsersFixture
()[
idx
];
...
...
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