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
8dfbb726
Commit
8dfbb726
authored
Nov 28, 2019
by
Andrew Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Edit Feature Flags Form Pass in Jest
Using `setImmediate` instead of `setTimeout` did the trick!
parent
c878923a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
25 deletions
+15
-25
ee/spec/frontend/feature_flags/components/edit_feature_flag_spec.js
...ontend/feature_flags/components/edit_feature_flag_spec.js
+15
-25
No files found.
ee/spec/frontend/feature_flags/components/edit_feature_flag_spec.js
View file @
8dfbb726
...
...
@@ -38,7 +38,7 @@ describe('Edit feature flag form', () => {
});
};
beforeEach
(
()
=>
{
beforeEach
(
done
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
`
${
TEST_HOST
}
/feature_flags.json'`
).
replyOnce
(
200
,
{
...
...
@@ -63,6 +63,8 @@ describe('Edit feature flag form', () => {
});
factory
();
setImmediate
(()
=>
done
());
});
afterEach
(()
=>
{
...
...
@@ -70,41 +72,29 @@ describe('Edit feature flag form', () => {
mock
.
restore
();
});
it
(
'
should display the iid
'
,
done
=>
{
setTimeout
(()
=>
{
expect
(
wrapper
.
find
(
'
h3
'
).
text
()).
toContain
(
'
^5
'
);
done
();
});
it
(
'
should display the iid
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
h3
'
).
text
()).
toContain
(
'
^5
'
);
});
describe
(
'
with error
'
,
()
=>
{
it
(
'
should render the error
'
,
done
=>
{
setTimeout
(()
=>
{
store
.
dispatch
(
'
edit/receiveUpdateFeatureFlagError
'
,
{
message
:
[
'
The name is required
'
]
});
store
.
dispatch
(
'
edit/receiveUpdateFeatureFlagError
'
,
{
message
:
[
'
The name is required
'
]
});
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
find
(
'
.alert-danger
'
).
exists
()).
toEqual
(
true
);
expect
(
wrapper
.
find
(
'
.alert-danger
'
).
text
()).
toContain
(
'
The name is required
'
);
done
();
});
},
0
);
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
find
(
'
.alert-danger
'
).
exists
()).
toEqual
(
true
);
expect
(
wrapper
.
find
(
'
.alert-danger
'
).
text
()).
toContain
(
'
The name is required
'
);
done
();
});
});
});
describe
(
'
without error
'
,
()
=>
{
it
(
'
renders form title
'
,
done
=>
{
setTimeout
(()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
'
^5 feature_flag
'
);
done
();
},
0
);
it
(
'
renders form title
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
'
^5 feature_flag
'
);
});
it
(
'
should render feature flag form
'
,
done
=>
{
setTimeout
(()
=>
{
expect
(
wrapper
.
find
(
Form
).
exists
()).
toEqual
(
true
);
done
();
},
0
);
it
(
'
should render feature flag form
'
,
()
=>
{
expect
(
wrapper
.
find
(
Form
).
exists
()).
toEqual
(
true
);
});
});
});
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