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
ea6fb669
Commit
ea6fb669
authored
Jun 02, 2020
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mock setup and teardown to before/after each
parent
573a9175
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
spec/frontend/diffs/store/actions_spec.js
spec/frontend/diffs/store/actions_spec.js
+22
-14
No files found.
spec/frontend/diffs/store/actions_spec.js
View file @
ea6fb669
...
...
@@ -174,9 +174,18 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
fetchDiffFilesBatch
'
,
()
=>
{
let
mock
;
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
should fetch batch diff files
'
,
done
=>
{
const
endpointBatch
=
'
/fetch/diffs_batch
'
;
const
mock
=
new
MockAdapter
(
axios
);
const
res1
=
{
diff_files
:
[],
pagination
:
{
next_page
:
2
}
};
const
res2
=
{
diff_files
:
[],
pagination
:
{}
};
mock
...
...
@@ -219,10 +228,7 @@ describe('DiffsStoreActions', () => {
{
type
:
types
.
SET_RETRIEVING_BATCHES
,
payload
:
false
},
],
[],
()
=>
{
mock
.
restore
();
done
();
},
done
,
);
});
...
...
@@ -234,7 +240,6 @@ describe('DiffsStoreActions', () => {
'
should make a request with the view parameter "$viewStyle" when the batchEndpoint already contains "$otherView"
'
,
({
viewStyle
,
otherView
})
=>
{
const
endpointBatch
=
'
/fetch/diffs_batch
'
;
const
mock
=
new
MockAdapter
(
axios
);
fetchDiffFilesBatch
({
commit
:
()
=>
{},
...
...
@@ -247,7 +252,6 @@ describe('DiffsStoreActions', () => {
.
then
(()
=>
{
expect
(
mock
.
history
.
get
[
0
].
url
).
toContain
(
`view=
${
viewStyle
}
`
);
expect
(
mock
.
history
.
get
[
0
].
url
).
not
.
toContain
(
`view=
${
otherView
}
`
);
mock
.
restore
();
})
.
catch
(()
=>
{});
},
...
...
@@ -322,9 +326,18 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
fetchDiffFilesBatch
'
,
()
=>
{
let
mock
;
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
should fetch batch diff files
'
,
done
=>
{
const
endpointBatch
=
'
/fetch/diffs_batch
'
;
const
mock
=
new
MockAdapter
(
axios
);
const
res1
=
{
diff_files
:
[],
pagination
:
{
next_page
:
2
}
};
const
res2
=
{
diff_files
:
[],
pagination
:
{}
};
mock
...
...
@@ -347,10 +360,7 @@ describe('DiffsStoreActions', () => {
{
type
:
types
.
SET_RETRIEVING_BATCHES
,
payload
:
false
},
],
[],
()
=>
{
mock
.
restore
();
done
();
},
done
,
);
});
...
...
@@ -363,7 +373,6 @@ describe('DiffsStoreActions', () => {
'
should use the endpoint $requestUrl if the endpointBatch in state includes `$querystrings` as a querystring
'
,
({
querystrings
,
requestUrl
})
=>
{
const
endpointBatch
=
'
/fetch/diffs_batch
'
;
const
mock
=
new
MockAdapter
(
axios
);
fetchDiffFilesBatch
({
commit
:
()
=>
{},
...
...
@@ -374,7 +383,6 @@ describe('DiffsStoreActions', () => {
})
.
then
(()
=>
{
expect
(
mock
.
history
.
get
[
0
].
url
).
toEqual
(
requestUrl
);
mock
.
restore
();
})
.
catch
(()
=>
{});
},
...
...
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