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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
9c8d8079
Commit
9c8d8079
authored
Jul 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
karma fixes
parent
b2ff2e8d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
45 deletions
+64
-45
app/assets/javascripts/ide/stores/modules/pipelines/actions.js
...ssets/javascripts/ide/stores/modules/pipelines/actions.js
+1
-1
spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
...scripts/ide/stores/modules/merge_requests/actions_spec.js
+13
-15
spec/javascripts/ide/stores/modules/pipelines/actions_spec.js
.../javascripts/ide/stores/modules/pipelines/actions_spec.js
+50
-29
No files found.
app/assets/javascripts/ide/stores/modules/pipelines/actions.js
View file @
9c8d8079
...
@@ -66,7 +66,7 @@ export const fetchLatestPipeline = ({ dispatch, rootGetters }) => {
...
@@ -66,7 +66,7 @@ export const fetchLatestPipeline = ({ dispatch, rootGetters }) => {
});
});
if
(
!
Visibility
.
hidden
())
{
if
(
!
Visibility
.
hidden
())
{
dispatch
(
'
forcePipelineRequest
'
);
eTagPoll
.
makeRequest
(
);
}
}
Visibility
.
change
(()
=>
{
Visibility
.
change
(()
=>
{
...
...
spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
View file @
9c8d8079
...
@@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter';
...
@@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter';
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
state
from
'
~/ide/stores/modules/merge_requests/state
'
;
import
state
from
'
~/ide/stores/modules/merge_requests/state
'
;
import
*
as
types
from
'
~/ide/stores/modules/merge_requests/mutation_types
'
;
import
*
as
types
from
'
~/ide/stores/modules/merge_requests/mutation_types
'
;
import
actions
,
{
import
{
requestMergeRequests
,
requestMergeRequests
,
receiveMergeRequestsError
,
receiveMergeRequestsError
,
receiveMergeRequestsSuccess
,
receiveMergeRequestsSuccess
,
...
@@ -41,28 +41,26 @@ describe('IDE merge requests actions', () => {
...
@@ -41,28 +41,26 @@ describe('IDE merge requests actions', () => {
});
});
describe
(
'
receiveMergeRequestsError
'
,
()
=>
{
describe
(
'
receiveMergeRequestsError
'
,
()
=>
{
let
flashSpy
;
beforeEach
(()
=>
{
flashSpy
=
spyOnDependency
(
actions
,
'
flash
'
);
});
it
(
'
should should commit error
'
,
done
=>
{
it
(
'
should should commit error
'
,
done
=>
{
testAction
(
testAction
(
receiveMergeRequestsError
,
receiveMergeRequestsError
,
'
created
'
,
{
type
:
'
created
'
,
search
:
''
}
,
mockedState
,
mockedState
,
[{
type
:
types
.
RECEIVE_MERGE_REQUESTS_ERROR
,
payload
:
'
created
'
}],
[{
type
:
types
.
RECEIVE_MERGE_REQUESTS_ERROR
,
payload
:
'
created
'
}],
[],
[
{
type
:
'
setErrorMessage
'
,
payload
:
{
text
:
'
Error loading merge requests.
'
,
action
:
jasmine
.
any
(
Function
),
actionText
:
'
Please try again
'
,
actionPayload
:
{
type
:
'
created
'
,
search
:
''
},
},
},
],
done
,
done
,
);
);
});
});
it
(
'
creates flash message
'
,
()
=>
{
receiveMergeRequestsError
({
commit
()
{}
},
'
created
'
);
expect
(
flashSpy
).
toHaveBeenCalled
();
});
});
});
describe
(
'
receiveMergeRequestsSuccess
'
,
()
=>
{
describe
(
'
receiveMergeRequestsSuccess
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/modules/pipelines/actions_spec.js
View file @
9c8d8079
import
Visibility
from
'
visibilityjs
'
;
import
Visibility
from
'
visibilityjs
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
actions
,
{
import
{
requestLatestPipeline
,
requestLatestPipeline
,
receiveLatestPipelineError
,
receiveLatestPipelineError
,
receiveLatestPipelineSuccess
,
receiveLatestPipelineSuccess
,
...
@@ -59,7 +59,7 @@ describe('IDE pipelines actions', () => {
...
@@ -59,7 +59,7 @@ describe('IDE pipelines actions', () => {
it
(
'
commits error
'
,
done
=>
{
it
(
'
commits error
'
,
done
=>
{
testAction
(
testAction
(
receiveLatestPipelineError
,
receiveLatestPipelineError
,
null
,
{
response
:
{
status
:
404
}
}
,
mockedState
,
mockedState
,
[{
type
:
types
.
RECEIVE_LASTEST_PIPELINE_ERROR
}],
[{
type
:
types
.
RECEIVE_LASTEST_PIPELINE_ERROR
}],
[{
type
:
'
stopPipelinePolling
'
}],
[{
type
:
'
stopPipelinePolling
'
}],
...
@@ -67,12 +67,26 @@ describe('IDE pipelines actions', () => {
...
@@ -67,12 +67,26 @@ describe('IDE pipelines actions', () => {
);
);
});
});
it
(
'
creates flash message
'
,
()
=>
{
it
(
'
dispatches setErrorMessage is not 404
'
,
done
=>
{
const
flashSpy
=
spyOnDependency
(
actions
,
'
flash
'
);
testAction
(
receiveLatestPipelineError
,
receiveLatestPipelineError
({
commit
()
{},
dispatch
()
{}
});
{
response
:
{
status
:
500
}
},
mockedState
,
expect
(
flashSpy
).
toHaveBeenCalled
();
[{
type
:
types
.
RECEIVE_LASTEST_PIPELINE_ERROR
}],
[
{
type
:
'
setErrorMessage
'
,
payload
:
{
text
:
'
An error occured whilst fetching the latest pipline.
'
,
action
:
jasmine
.
any
(
Function
),
actionText
:
'
Please try again
'
,
actionPayload
:
null
,
},
},
{
type
:
'
stopPipelinePolling
'
},
],
done
,
);
});
});
});
});
...
@@ -181,7 +195,10 @@ describe('IDE pipelines actions', () => {
...
@@ -181,7 +195,10 @@ describe('IDE pipelines actions', () => {
new
Promise
(
resolve
=>
requestAnimationFrame
(
resolve
))
new
Promise
(
resolve
=>
requestAnimationFrame
(
resolve
))
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
dispatch
.
calls
.
argsFor
(
1
)).
toEqual
([
'
receiveLatestPipelineError
'
]);
expect
(
dispatch
.
calls
.
argsFor
(
1
)).
toEqual
([
'
receiveLatestPipelineError
'
,
jasmine
.
anything
(),
]);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -199,21 +216,23 @@ describe('IDE pipelines actions', () => {
...
@@ -199,21 +216,23 @@ describe('IDE pipelines actions', () => {
it
(
'
commits error
'
,
done
=>
{
it
(
'
commits error
'
,
done
=>
{
testAction
(
testAction
(
receiveJobsError
,
receiveJobsError
,
1
,
{
id
:
1
}
,
mockedState
,
mockedState
,
[{
type
:
types
.
RECEIVE_JOBS_ERROR
,
payload
:
1
}],
[{
type
:
types
.
RECEIVE_JOBS_ERROR
,
payload
:
1
}],
[],
[
{
type
:
'
setErrorMessage
'
,
payload
:
{
text
:
'
An error occured whilst loading the pipelines jobs.
'
,
action
:
jasmine
.
anything
(),
actionText
:
'
Please try again
'
,
actionPayload
:
{
id
:
1
},
},
},
],
done
,
done
,
);
);
});
});
it
(
'
creates flash message
'
,
()
=>
{
const
flashSpy
=
spyOnDependency
(
actions
,
'
flash
'
);
receiveJobsError
({
commit
()
{}
},
1
);
expect
(
flashSpy
).
toHaveBeenCalled
();
});
});
});
describe
(
'
receiveJobsSuccess
'
,
()
=>
{
describe
(
'
receiveJobsSuccess
'
,
()
=>
{
...
@@ -268,7 +287,7 @@ describe('IDE pipelines actions', () => {
...
@@ -268,7 +287,7 @@ describe('IDE pipelines actions', () => {
[],
[],
[
[
{
type
:
'
requestJobs
'
,
payload
:
stage
.
id
},
{
type
:
'
requestJobs
'
,
payload
:
stage
.
id
},
{
type
:
'
receiveJobsError
'
,
payload
:
stage
.
id
},
{
type
:
'
receiveJobsError
'
,
payload
:
stage
},
],
],
done
,
done
,
);
);
...
@@ -337,18 +356,20 @@ describe('IDE pipelines actions', () => {
...
@@ -337,18 +356,20 @@ describe('IDE pipelines actions', () => {
null
,
null
,
mockedState
,
mockedState
,
[{
type
:
types
.
RECEIVE_JOB_TRACE_ERROR
}],
[{
type
:
types
.
RECEIVE_JOB_TRACE_ERROR
}],
[],
[
{
type
:
'
setErrorMessage
'
,
payload
:
{
text
:
'
An error occured whilst fetching the job trace.
'
,
action
:
jasmine
.
any
(
Function
),
actionText
:
'
Please try again
'
,
actionPayload
:
null
,
},
},
],
done
,
done
,
);
);
});
});
it
(
'
creates flash message
'
,
()
=>
{
const
flashSpy
=
spyOnDependency
(
actions
,
'
flash
'
);
receiveJobTraceError
({
commit
()
{}
});
expect
(
flashSpy
).
toHaveBeenCalled
();
});
});
});
describe
(
'
receiveJobTraceSuccess
'
,
()
=>
{
describe
(
'
receiveJobTraceSuccess
'
,
()
=>
{
...
...
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