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
9169e811
Commit
9169e811
authored
Nov 12, 2019
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce code duplication
parent
24574e32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
81 deletions
+40
-81
ee/spec/frontend/feature_flags/components/feature_flags_table_spec.js
...tend/feature_flags/components/feature_flags_table_spec.js
+40
-81
No files found.
ee/spec/frontend/feature_flags/components/feature_flags_table_spec.js
View file @
9169e811
...
@@ -9,31 +9,10 @@ import {
...
@@ -9,31 +9,10 @@ import {
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
describe
(
'
Feature flag table
'
,
()
=>
{
const
getDefaultProps
=
()
=>
({
let
wrapper
;
const
createWrapper
=
(
propsData
,
opts
=
{})
=>
{
wrapper
=
shallowMount
(
FeatureFlagsTable
,
{
propsData
,
sync
:
false
,
localVue
,
...
opts
,
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
with an active scope and a standard rollout strategy
'
,
()
=>
{
beforeEach
(()
=>
{
createWrapper
(
{
featureFlags
:
[
featureFlags
:
[
{
{
id
:
1
,
id
:
1
,
iid
:
1
,
active
:
true
,
active
:
true
,
name
:
'
flag name
'
,
name
:
'
flag name
'
,
description
:
'
flag description
'
,
description
:
'
flag description
'
,
...
@@ -54,11 +33,36 @@ describe('Feature flag table', () => {
...
@@ -54,11 +33,36 @@ describe('Feature flag table', () => {
},
},
],
],
csrfToken
:
'
fakeToken
'
,
csrfToken
:
'
fakeToken
'
,
},
});
{
describe
(
'
Feature flag table
'
,
()
=>
{
let
wrapper
;
let
props
;
const
createWrapper
=
(
propsData
,
opts
=
{})
=>
{
wrapper
=
shallowMount
(
FeatureFlagsTable
,
{
propsData
,
sync
:
false
,
localVue
,
...
opts
,
});
};
beforeEach
(()
=>
{
props
=
getDefaultProps
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
with an active scope and a standard rollout strategy
'
,
()
=>
{
beforeEach
(()
=>
{
props
.
featureFlags
[
0
].
iid
=
1
;
createWrapper
(
props
,
{
provide
:
{
glFeatures
:
{
featureFlagIID
:
true
}
},
provide
:
{
glFeatures
:
{
featureFlagIID
:
true
}
},
},
});
);
});
});
it
(
'
Should render a table
'
,
()
=>
{
it
(
'
Should render a table
'
,
()
=>
{
...
@@ -111,31 +115,9 @@ describe('Feature flag table', () => {
...
@@ -111,31 +115,9 @@ describe('Feature flag table', () => {
describe
(
'
with an active scope and a percentage rollout strategy
'
,
()
=>
{
describe
(
'
with an active scope and a percentage rollout strategy
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createWrapper
({
props
.
featureFlags
[
0
].
scopes
[
0
].
rolloutStrategy
=
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
;
featureFlags
:
[
props
.
featureFlags
[
0
].
scopes
[
0
].
rolloutPercentage
=
'
54
'
;
{
createWrapper
(
props
);
id
:
1
,
active
:
true
,
name
:
'
flag name
'
,
description
:
'
flag description
'
,
destroy_path
:
'
destroy/path
'
,
edit_path
:
'
edit/path
'
,
scopes
:
[
{
id
:
1
,
active
:
true
,
environmentScope
:
'
scope
'
,
canUpdate
:
true
,
protected
:
false
,
rolloutStrategy
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
rolloutPercentage
:
'
54
'
,
shouldBeDestroyed
:
false
,
},
],
},
],
csrfToken
:
'
fakeToken
'
,
});
});
});
it
(
'
should render an environments specs badge with percentage
'
,
()
=>
{
it
(
'
should render an environments specs badge with percentage
'
,
()
=>
{
...
@@ -147,31 +129,8 @@ describe('Feature flag table', () => {
...
@@ -147,31 +129,8 @@ describe('Feature flag table', () => {
describe
(
'
with an inactive scope
'
,
()
=>
{
describe
(
'
with an inactive scope
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createWrapper
({
props
.
featureFlags
[
0
].
scopes
[
0
].
active
=
false
;
featureFlags
:
[
createWrapper
(
props
);
{
id
:
1
,
active
:
true
,
name
:
'
flag name
'
,
description
:
'
flag description
'
,
destroy_path
:
'
destroy/path
'
,
edit_path
:
'
edit/path
'
,
scopes
:
[
{
id
:
1
,
active
:
false
,
environmentScope
:
'
scope
'
,
canUpdate
:
true
,
protected
:
false
,
rolloutStrategy
:
ROLLOUT_STRATEGY_ALL_USERS
,
rolloutPercentage
:
DEFAULT_PERCENT_ROLLOUT
,
shouldBeDestroyed
:
false
,
},
],
},
],
csrfToken
:
'
fakeToken
'
,
});
});
});
it
(
'
should render an environments specs badge with inactive class
'
,
()
=>
{
it
(
'
should render an environments specs badge with inactive class
'
,
()
=>
{
...
...
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