diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2017-05-19 15:12:41 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-05-19 15:12:41 +0000 |
commit | 60d5063d15fd43f89d5b4ebf379d7a64768a0953 (patch) | |
tree | 2925d28c8c3ff2f354ebac02601c2b81cf09429b /doc | |
parent | baa6a08908c038b872877e27d229dc3e1543fc58 (diff) | |
parent | fe3458e36b63686db5d7989e122a4a260d3fd2de (diff) | |
download | gitlab-ce-60d5063d15fd43f89d5b4ebf379d7a64768a0953.tar.gz |
Merge branch 'winh-testing-promises-docs' into 'master'
Minor changes to Testing Promises section
See merge request !11517
Diffstat (limited to 'doc')
-rw-r--r-- | doc/development/fe_guide/testing.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/doc/development/fe_guide/testing.md b/doc/development/fe_guide/testing.md index 5c6bdc97ef6..0ef9fc61a61 100644 --- a/doc/development/fe_guide/testing.md +++ b/doc/development/fe_guide/testing.md @@ -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. ```javascript -/// Good +// Good it('tests a promise', (done) => { promise .then((data) => { @@ -84,9 +84,10 @@ it('tests a promise', (done) => { .catch(done.fail); }); -/// Good +// Good it('tests a promise rejection', (done) => { promise + .then(done.fail) .catch((error) => { expect(error).toBe(expectedError); }) @@ -94,7 +95,7 @@ it('tests a promise rejection', (done) => { .catch(done.fail); }); -/// Bad (missing done callback) +// Bad (missing done callback) it('tests a promise', () => { promise .then((data) => { @@ -102,7 +103,7 @@ it('tests a promise', () => { }) }); -/// Bad (missing catch) +// Bad (missing catch) it('tests a promise', (done) => { promise .then((data) => { @@ -111,7 +112,7 @@ it('tests a promise', (done) => { .then(done) }); -/// Bad (use done.fail in asynchronous tests) +// Bad (use done.fail in asynchronous tests) it('tests a promise', (done) => { promise .then((data) => { @@ -121,7 +122,7 @@ it('tests a promise', (done) => { .catch(fail) }); -/// Bad (missing catch) +// Bad (missing catch) it('tests a promise rejection', (done) => { promise .catch((error) => { |