Created
March 13, 2014 01:45
-
-
Save fengmk2/9520498 to your computer and use it in GitHub Desktop.
co very nice to mocha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('example of co work with mocha', function () { | |
| it('should work', co(function *() { | |
| var result = yield *urllib.request('http://cnpmjs.org', {dataType: 'json'}); | |
| result.should.have.keys('data', 'status', 'headers'); | |
| result.status.should.equal(200); | |
| result.data.should.be.an.Object; | |
| result.headers['content-type'].should.equal('application/json'); | |
| })); | |
| }); | |
| // `co(function *() {});` will return a thunk: `function (done) {};` |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console.log(co(function *() {}));