Skip to content

Commit

Permalink
refactor(test): do not have both s and server, renamed to `server…
Browse files Browse the repository at this point in the history
…` for consistency
  • Loading branch information
lamweili committed Oct 3, 2022
1 parent 8bf4c14 commit c1c4402
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/supertest.js
Expand Up @@ -20,14 +20,14 @@ function shouldIncludeStackWithThisFile(err) {
describe('request(url)', function () {
it('should be supported', function (done) {
const app = express();
let s;
let server;

app.get('/', function (req, res) {
res.send('hello');
});

s = app.listen(function () {
const url = 'http://localhost:' + s.address().port;
server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
request(url)
.get('/')
.expect('hello', done);
Expand All @@ -37,14 +37,14 @@ describe('request(url)', function () {
describe('.end(cb)', function () {
it('should set `this` to the test object when calling cb', function (done) {
const app = express();
let s;
let server;

app.get('/', function (req, res) {
res.send('hello');
});

s = app.listen(function () {
const url = 'http://localhost:' + s.address().port;
server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
const test = request(url).get('/');
test.end(function (err, res) {
this.should.eql(test);
Expand Down Expand Up @@ -93,12 +93,13 @@ describe('request(app)', function () {

it('should work with remote server', function (done) {
const app = express();
let server;

app.get('/', function (req, res) {
res.send('hey');
});

app.listen(4001, function () {
server = app.listen(4001, function () {
request('http://localhost:4001')
.get('/')
.end(function (err, res) {
Expand Down

0 comments on commit c1c4402

Please sign in to comment.