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
4b55afca
Commit
4b55afca
authored
Dec 31, 2019
by
Illya Klymov
Committed by
Kushal Pandya
Dec 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for axios mock promise to resolve
Update spec to properly wait for promise to resolve
parent
8bcf5387
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
ee/spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js
...tom_metrics/components/custom_metrics_form_fields_spec.js
+20
-11
No files found.
ee/spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js
View file @
4b55afca
import
{
mount
}
from
'
@vue/test-utils
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
CustomMetricsFormFields
from
'
ee/custom_metrics/components/custom_metrics_form_fields.vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
...
...
@@ -180,11 +181,15 @@ describe('custom metrics form fields component', () => {
component
.
vm
.
$nextTick
(()
=>
{
expect
(
component
.
vm
.
queryValidateInFlight
).
toBe
(
true
);
jest
.
runOnlyPendingTimers
();
component
.
vm
.
$nextTick
(()
=>
{
expect
(
component
.
vm
.
queryValidateInFlight
).
toBe
(
false
);
expect
(
component
.
vm
.
queryIsValid
).
toBe
(
true
);
done
();
});
waitForPromises
()
.
then
(()
=>
{
component
.
vm
.
$nextTick
(()
=>
{
expect
(
component
.
vm
.
queryValidateInFlight
).
toBe
(
false
);
expect
(
component
.
vm
.
queryIsValid
).
toBe
(
true
);
done
();
});
})
.
catch
(
done
.
fail
);
});
});
...
...
@@ -205,12 +210,16 @@ describe('custom metrics form fields component', () => {
queryInput
.
trigger
(
'
input
'
);
component
.
vm
.
$nextTick
(()
=>
{
jest
.
runOnlyPendingTimers
();
component
.
vm
.
$nextTick
(()
=>
{
expect
(
component
.
vm
.
queryValidateInFlight
).
toBe
(
false
);
expect
(
component
.
vm
.
queryIsValid
).
toBe
(
true
);
expect
(
component
.
vm
.
errorMessage
).
toBe
(
''
);
done
();
});
waitForPromises
()
.
then
(()
=>
{
component
.
vm
.
$nextTick
(()
=>
{
expect
(
component
.
vm
.
queryValidateInFlight
).
toBe
(
false
);
expect
(
component
.
vm
.
queryIsValid
).
toBe
(
true
);
expect
(
component
.
vm
.
errorMessage
).
toBe
(
''
);
done
();
});
})
.
catch
(
done
.
fail
);
});
});
});
...
...
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