Skip to content

Instantly share code, notes, and snippets.

@Joris-van-der-Wel
Created February 11, 2016 22:07
Show Gist options
  • Save Joris-van-der-Wel/006b5bbdb9eac060ced0 to your computer and use it in GitHub Desktop.
Save Joris-van-der-Wel/006b5bbdb9eac060ced0 to your computer and use it in GitHub Desktop.
Indent chained methods?
specify("explicit config.html, a string that is also a valid file", () => {
return readTestFixture("jsdom/files/env.html")
.then(body => {
return nodeResolverPromise(done => {
env({
html: body,
url: "http://example.com/",
done
});
})
.then(window => {
assert.equal(serializeDocument(window.document), "<html><head></head><body>" + body + "</body></html>");
assert.equal(window.location.href, "http://example.com/");
});
});
});
// Or:
specify("explicit config.html, a string that is also a valid file", () => {
return readTestFixture("jsdom/files/env.html")
.then(body => {
return nodeResolverPromise(done => {
env({
html: body,
url: "http://example.com/",
done
});
})
.then(window => {
assert.equal(serializeDocument(window.document), "<html><head></head><body>" + body + "</body></html>");
assert.equal(window.location.href, "http://example.com/");
});
});
});
@domenic
Copy link

domenic commented Feb 11, 2016

I often enjoy

return foo().then(x => {
  ...
})
.then(y => {
  ...
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment