Skip to content

Commit c1c4402

Browse files
committedOct 3, 2022
refactor(test): do not have both s and server, renamed to server for consistency
1 parent 8bf4c14 commit c1c4402

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed
 

Diff for: ‎test/supertest.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ function shouldIncludeStackWithThisFile(err) {
2020
describe('request(url)', function () {
2121
it('should be supported', function (done) {
2222
const app = express();
23-
let s;
23+
let server;
2424

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

29-
s = app.listen(function () {
30-
const url = 'http://localhost:' + s.address().port;
29+
server = app.listen(function () {
30+
const url = 'http://localhost:' + server.address().port;
3131
request(url)
3232
.get('/')
3333
.expect('hello', done);
@@ -37,14 +37,14 @@ describe('request(url)', function () {
3737
describe('.end(cb)', function () {
3838
it('should set `this` to the test object when calling cb', function (done) {
3939
const app = express();
40-
let s;
40+
let server;
4141

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

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

9494
it('should work with remote server', function (done) {
9595
const app = express();
96+
let server;
9697

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

101-
app.listen(4001, function () {
102+
server = app.listen(4001, function () {
102103
request('http://localhost:4001')
103104
.get('/')
104105
.end(function (err, res) {

0 commit comments

Comments
 (0)
Please sign in to comment.