Skip to content

Commit 762fe67

Browse files
committed
Shouldn't use arrow functions with mocha
1 parent 16fb229 commit 762fe67

File tree

3 files changed

+38
-68
lines changed

3 files changed

+38
-68
lines changed

test/ping.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,28 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
5454
continue;
5555
}
5656

57-
describe(`Ping ${pingProtocol} to ${protocol} returning ${returnFormat}`, () => {
58-
before(async () => {
57+
describe(`Ping ${pingProtocol} to ${protocol} returning ${returnFormat}`, function () {
58+
before(async function () {
5959
await mongodb.before();
6060
await mock.before();
6161
});
6262

63-
after(async () => {
63+
after(async function () {
6464
await mongodb.after();
6565
await mock.after();
6666
});
6767

68-
beforeEach(async () => {
68+
beforeEach(async function () {
6969
await mongodb.beforeEach();
7070
await mock.beforeEach();
7171
});
7272

73-
afterEach(async () => {
73+
afterEach(async function () {
7474
await mongodb.afterEach();
7575
await mock.afterEach();
7676
});
7777

78-
it(`should accept a ping for new resource`, async () => {
78+
it(`should accept a ping for new resource`, async function () {
7979
const feedPath = '/rss.xml',
8080
pingPath = '/feedupdated',
8181
resourceUrl = mock.serverUrl + feedPath;
@@ -121,7 +121,7 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
121121
}
122122
});
123123

124-
it('should reject a ping for bad resource', async () => {
124+
it('should reject a ping for bad resource', async function () {
125125
const feedPath = '/rss.xml',
126126
pingPath = '/feedupdated',
127127
resourceUrl = mock.serverUrl + feedPath;
@@ -162,7 +162,7 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
162162
}
163163
});
164164

165-
it('should reject a ping with a missing url', async () => {
165+
it('should reject a ping with a missing url', async function () {
166166
const feedPath = '/rss.xml',
167167
pingPath = '/feedupdated',
168168
resourceUrl = null;
@@ -202,7 +202,7 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
202202
}
203203
});
204204

205-
it('should accept a ping for unchanged resource', async () => {
205+
it('should accept a ping for unchanged resource', async function () {
206206
const feedPath = '/rss.xml',
207207
pingPath = '/feedupdated',
208208
resourceUrl = mock.serverUrl + feedPath;

test/please-notify.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,29 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
4444
continue;
4545
}
4646

47-
describe(`PleaseNotify ${pingProtocol} to ${protocol} returning ${returnFormat}`, () => {
47+
describe(`PleaseNotify ${pingProtocol} to ${protocol} returning ${returnFormat}`, function () {
4848

49-
before(async () => {
49+
before(async function () {
5050
await mongodb.before();
5151
await mock.before();
5252
});
5353

54-
after(async () => {
54+
after(async function () {
5555
await mongodb.after();
5656
await mock.after();
5757
});
5858

59-
beforeEach(async () => {
59+
beforeEach(async function () {
6060
await mongodb.beforeEach();
6161
await mock.beforeEach();
6262
});
6363

64-
afterEach(async () => {
64+
afterEach(async function () {
6565
await mongodb.afterEach();
6666
await mock.afterEach();
6767
});
6868

69-
it('should accept a pleaseNotify for new resource', async () => {
69+
it('should accept a pleaseNotify for new resource', async function () {
7070
const feedPath = '/rss.xml',
7171
resourceUrl = mock.serverUrl + feedPath;
7272

@@ -127,7 +127,7 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
127127
}
128128
});
129129

130-
it('should accept a pleaseNotify without domain for new resource', async () => {
130+
it('should accept a pleaseNotify without domain for new resource', async function () {
131131
const feedPath = '/rss.xml',
132132
resourceUrl = mock.serverUrl + feedPath;
133133

@@ -186,7 +186,7 @@ for (const pingProtocol of ['XML-RPC', 'REST']) {
186186
}
187187
});
188188

189-
it('should reject a pleaseNotify for bad resource', async () => {
189+
it('should reject a pleaseNotify for bad resource', async function () {
190190
const feedPath = '/rss.xml',
191191
resourceUrl = mock.serverUrl + feedPath;
192192

test/static.js

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,76 +5,46 @@ const chai = require("chai"),
55

66
chai.use(chaiHttp);
77

8-
describe("Static Pages", () => {
8+
describe("Static Pages", function () {
99

10-
it("docs should return 200", done => {
11-
chai
10+
it("docs should return 200", async function () {
11+
let res = await chai
1212
.request(SERVER_URL)
13-
.get("/docs")
14-
.end((err, res) => {
15-
if (err) {
16-
return done(err);
17-
}
13+
.get("/docs");
1814

19-
expect(res).status(200);
20-
done();
21-
});
15+
expect(res).status(200);
2216
});
2317

24-
it("home should return 200", done => {
25-
chai
18+
it("home should return 200", async function () {
19+
let res = await chai
2620
.request(SERVER_URL)
27-
.get("/")
28-
.end((err, res) => {
29-
if (err) {
30-
return done(err);
31-
}
21+
.get("/");
3222

33-
expect(res).status(200);
34-
done();
35-
});
23+
expect(res).status(200);
3624
});
3725

38-
it("pingForm should return 200", done => {
39-
chai
26+
it("pingForm should return 200", async function () {
27+
let res = await chai
4028
.request(SERVER_URL)
41-
.get("/pingForm")
42-
.end((err, res) => {
43-
if (err) {
44-
return done(err);
45-
}
29+
.get("/pingForm");
4630

47-
expect(res).status(200);
48-
done();
49-
});
31+
expect(res).status(200);
5032
});
5133

52-
it("pleaseNotifyForm should return 200", done => {
53-
chai
34+
it("pleaseNotifyForm should return 200", async function () {
35+
let res = await chai
5436
.request(SERVER_URL)
55-
.get("/pleaseNotifyForm")
56-
.end((err, res) => {
57-
if (err) {
58-
return done(err);
59-
}
37+
.get("/pleaseNotifyForm");
6038

61-
expect(res).status(200);
62-
done();
63-
});
39+
expect(res).status(200);
6440
});
6541

66-
it("viewLog should return 200", done => {
67-
chai
42+
it("viewLog should return 200", async function () {
43+
let res = await chai
6844
.request(SERVER_URL)
69-
.get("/viewLog")
70-
.end((err, res) => {
71-
if (err) {
72-
return done(err);
73-
}
45+
.get("/viewLog");
7446

75-
expect(res).status(200);
76-
done();
77-
});
47+
expect(res).status(200);
7848
});
7949

8050
});

0 commit comments

Comments
 (0)