Last active
August 29, 2015 14:21
-
-
Save haru01/2b3ef0ce351ed1e9dad6 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
var fetch = require('node-fetch'); | |
var assert = require('power-assert'); | |
function fetchPost() { | |
return fetch("http://jsonplaceholder.typicode.com/posts/1") | |
.then(function(res) { | |
return res.json(); | |
}).catch(function(e) { | |
throw e; | |
}); | |
} | |
describe('fetch & promise & power-assert', function () { | |
it("should fetch post", function (done) { | |
fetchPost() | |
.then(function(post) { | |
assert(post.id === 2) // fail | |
done(); | |
}).catch(done); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment