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
d4e88f6b
Commit
d4e88f6b
authored
Jul 30, 2020
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added additional specs
parent
f9c64e5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
18 deletions
+13
-18
ee/app/assets/javascripts/analytics/cycle_analytics/components/recent_activity_card.vue
...ytics/cycle_analytics/components/recent_activity_card.vue
+2
-7
ee/spec/frontend/analytics/cycle_analytics/utils_spec.js
ee/spec/frontend/analytics/cycle_analytics/utils_spec.js
+11
-11
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/recent_activity_card.vue
View file @
d4e88f6b
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
import
Api
from
'
ee/api
'
;
import
Api
from
'
ee/api
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
slugify
}
from
'
~/lib/utils/text_utility
'
;
import
MetricCard
from
'
../../shared/components/metric_card.vue
'
;
import
MetricCard
from
'
../../shared/components/metric_card.vue
'
;
import
{
removeFlash
}
from
'
../utils
'
;
import
{
removeFlash
,
prepareTimeMetricsData
}
from
'
../utils
'
;
export
default
{
export
default
{
name
:
'
RecentActivityCard
'
,
name
:
'
RecentActivityCard
'
,
...
@@ -45,11 +44,7 @@ export default {
...
@@ -45,11 +44,7 @@ export default {
this
.
additionalParams
?
this
.
additionalParams
:
{},
this
.
additionalParams
?
this
.
additionalParams
:
{},
)
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
this
.
data
=
data
.
map
(({
title
:
label
,
value
})
=>
({
this
.
data
=
prepareTimeMetricsData
(
data
);
value
:
value
||
'
-
'
,
label
,
key
:
slugify
(
label
),
}));
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
createFlash
(
createFlash
(
...
...
ee/spec/frontend/analytics/cycle_analytics/utils_spec.js
View file @
d4e88f6b
import
{
isNumber
}
from
'
lodash
'
;
import
{
isNumber
}
from
'
lodash
'
;
import
{
getDatesInRange
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
getDatesInRange
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
slugify
}
from
'
~/lib/utils/text_utility
'
;
import
{
import
{
isStartEvent
,
isStartEvent
,
isLabelEvent
,
isLabelEvent
,
...
@@ -322,6 +323,7 @@ describe('Cycle analytics utils', () => {
...
@@ -322,6 +323,7 @@ describe('Cycle analytics utils', () => {
it
(
'
will remove an id that exists
'
,
()
=>
{
it
(
'
will remove an id that exists
'
,
()
=>
{
expect
(
toggleSelectedLabel
({
selectedLabelIds
,
value
:
2
})).
toEqual
([
1
,
3
]);
expect
(
toggleSelectedLabel
({
selectedLabelIds
,
value
:
2
})).
toEqual
([
1
,
3
]);
});
});
it
(
'
will add an id that does not exist
'
,
()
=>
{
it
(
'
will add an id that does not exist
'
,
()
=>
{
expect
(
toggleSelectedLabel
({
selectedLabelIds
,
value
:
4
})).
toEqual
([
1
,
2
,
3
,
4
]);
expect
(
toggleSelectedLabel
({
selectedLabelIds
,
value
:
4
})).
toEqual
([
1
,
2
,
3
,
4
]);
});
});
...
@@ -373,27 +375,25 @@ describe('Cycle analytics utils', () => {
...
@@ -373,27 +375,25 @@ describe('Cycle analytics utils', () => {
describe
(
'
prepareTimeMetricsData
'
,
()
=>
{
describe
(
'
prepareTimeMetricsData
'
,
()
=>
{
let
prepared
;
let
prepared
;
const
[{
title
:
firstTitle
},
{
title
:
secondTitle
}]
=
timeMetricsData
;
const
firstKey
=
slugify
(
firstTitle
);
const
secondKey
=
slugify
(
secondTitle
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
prepared
=
prepareTimeMetricsData
(
timeMetricsData
);
prepared
=
prepareTimeMetricsData
(
timeMetricsData
,
{
[
firstKey
]:
'
Is a value that is good
'
,
});
});
});
it
(
'
will add a `key` based on the title
'
,
()
=>
{
it
(
'
will add a `key` based on the title
'
,
()
=>
{
expect
(
timeMetricsData
).
not
.
toMatchObject
([{
key
:
'
lead-time
'
},
{
key
:
'
cycle-time
'
}]);
expect
(
prepared
).
toMatchObject
([{
key
:
firstKey
},
{
key
:
secondKey
}]);
expect
(
prepared
).
toMatchObject
([{
key
:
'
lead-time
'
},
{
key
:
'
cycle-time
'
}]);
});
});
it
(
'
will replace the title with a `label` key
'
,
()
=>
{
it
(
'
will add a `label` key
'
,
()
=>
{
expect
(
timeMetricsData
).
not
.
toMatchObject
([{
label
:
'
Lead Time
'
},
{
label
:
'
Cycle Time
'
}]);
expect
(
prepared
).
toMatchObject
([{
label
:
'
Lead Time
'
},
{
label
:
'
Cycle Time
'
}]);
expect
(
prepared
).
toMatchObject
([{
label
:
'
Lead Time
'
},
{
label
:
'
Cycle Time
'
}]);
});
});
it
(
'
will add tooltip text using the key if it is provided
'
,
()
=>
{
it
(
'
will add a tooltip text using the key if it is provided
'
,
()
=>
{
prepared
=
prepareTimeMetricsData
(
timeMetricsData
,
{
'
lead-time
'
:
'
Is a value that is good
'
,
});
expect
(
timeMetricsData
).
not
.
toMatchObject
([{
tooltipText
:
'
Is a value that is good
'
}]);
expect
(
prepared
).
toMatchObject
([
expect
(
prepared
).
toMatchObject
([
{
tooltipText
:
'
Is a value that is good
'
},
{
tooltipText
:
'
Is a value that is good
'
},
{
tooltipText
:
''
},
{
tooltipText
:
''
},
...
...
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