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
fe3458e3
Commit
fe3458e3
authored
May 18, 2017
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes to Testing Promises section
parent
e4eec191
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
doc/development/fe_guide/testing.md
doc/development/fe_guide/testing.md
+7
-6
No files found.
doc/development/fe_guide/testing.md
View file @
fe3458e3
...
@@ -74,7 +74,7 @@ When testing Promises you should always make sure that the test is asynchronous
...
@@ -74,7 +74,7 @@ When testing Promises you should always make sure that the test is asynchronous
Your Promise chain should therefore end with a call of the
`done`
callback and
`done.fail`
in case an error occurred.
Your Promise chain should therefore end with a call of the
`done`
callback and
`done.fail`
in case an error occurred.
```
javascript
```
javascript
//
/
Good
// Good
it
(
'
tests a promise
'
,
(
done
)
=>
{
it
(
'
tests a promise
'
,
(
done
)
=>
{
promise
promise
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -84,9 +84,10 @@ it('tests a promise', (done) => {
...
@@ -84,9 +84,10 @@ it('tests a promise', (done) => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
//
/
Good
// Good
it
(
'
tests a promise rejection
'
,
(
done
)
=>
{
it
(
'
tests a promise rejection
'
,
(
done
)
=>
{
promise
promise
.
then
(
done
.
fail
)
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
expect
(
error
).
toBe
(
expectedError
);
expect
(
error
).
toBe
(
expectedError
);
})
})
...
@@ -94,7 +95,7 @@ it('tests a promise rejection', (done) => {
...
@@ -94,7 +95,7 @@ it('tests a promise rejection', (done) => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
//
/
Bad (missing done callback)
// Bad (missing done callback)
it
(
'
tests a promise
'
,
()
=>
{
it
(
'
tests a promise
'
,
()
=>
{
promise
promise
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -102,7 +103,7 @@ it('tests a promise', () => {
...
@@ -102,7 +103,7 @@ it('tests a promise', () => {
})
})
});
});
//
/
Bad (missing catch)
// Bad (missing catch)
it
(
'
tests a promise
'
,
(
done
)
=>
{
it
(
'
tests a promise
'
,
(
done
)
=>
{
promise
promise
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -111,7 +112,7 @@ it('tests a promise', (done) => {
...
@@ -111,7 +112,7 @@ it('tests a promise', (done) => {
.
then
(
done
)
.
then
(
done
)
});
});
//
/
Bad (use done.fail in asynchronous tests)
// Bad (use done.fail in asynchronous tests)
it
(
'
tests a promise
'
,
(
done
)
=>
{
it
(
'
tests a promise
'
,
(
done
)
=>
{
promise
promise
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -121,7 +122,7 @@ it('tests a promise', (done) => {
...
@@ -121,7 +122,7 @@ it('tests a promise', (done) => {
.
catch
(
fail
)
.
catch
(
fail
)
});
});
//
/
Bad (missing catch)
// Bad (missing catch)
it
(
'
tests a promise rejection
'
,
(
done
)
=>
{
it
(
'
tests a promise rejection
'
,
(
done
)
=>
{
promise
promise
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
...
...
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