Skip to content

Instantly share code, notes, and snippets.

@saml
Last active September 6, 2016 13:55
Show Gist options
  • Save saml/38264476e15fc115dd8e2e0913fccc31 to your computer and use it in GitHub Desktop.
Save saml/38264476e15fc115dd8e2e0913fccc31 to your computer and use it in GitHub Desktop.
'use strict';
var supertest = require('supertest-as-promised');
var express = require('express');
const app = express();
function fetch() {
return supertest(app).get('/')
.send();
}
Promise.resolve(1)
.then((x) => {
var res = fetch();
console.log('First', typeof res.expect); // this is Function as expected.
return res;
})
.then((res) => {
console.log('Second', typeof res.expect); // why is this undefined?
return res;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment