Skip to content

Commit 7986327

Browse files
authored
Fixed ESLint issues in test files (#1964)
1 parent 0051647 commit 7986327

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+366
-0
lines changed

test/integration/arts.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe("Arts", function () {
4747
return done();
4848
});
4949
});
50+
5051
it("Should return 401, for Unauthenticated User", function (done) {
5152
chai
5253
.request(app)
@@ -111,6 +112,7 @@ describe("Arts", function () {
111112
return done();
112113
});
113114
});
115+
114116
it("Should return 401, for Unauthenticated User", function (done) {
115117
chai
116118
.request(app)

test/integration/auth.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe("auth", function () {
5151
expect(res).to.have.status(302);
5252
expect(res.headers.location).to.equal(githubOauthURL);
5353
});
54+
5455
it("should redirect the user to new sign up flow if they are have incomplete user details true", async function () {
5556
const redirectURL = "https://my.realdevsquad.com/new-signup";
5657

test/integration/authorizeRoles.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ describe("authorizeRoles", function () {
182182
return done();
183183
});
184184
});
185+
185186
it("should return server error for super user on route with invalid required role", function (done) {
186187
chai
187188
.request(app)
@@ -195,6 +196,7 @@ describe("authorizeRoles", function () {
195196
return done();
196197
});
197198
});
199+
198200
it("should return server error for app owner on route with invalid required role", function (done) {
199201
chai
200202
.request(app)

test/integration/contributions.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ describe("Contributions", function () {
5858
task.isNoteworthy = false;
5959
await testModel.updateTask(task);
6060
});
61+
6162
afterEach(function () {
6263
sinon.restore();
6364
});
65+
6466
describe("GET /contributions/{username}", function () {
6567
it("Should get all the contributions of the user", function (done) {
6668
sinon.stub(githubService, "fetchPRsByUser").returns(githubPRInfo.prakash);
@@ -104,6 +106,7 @@ describe("Contributions", function () {
104106
return done();
105107
});
106108
});
109+
107110
it("Should respond 404 for unregistered user", function (done) {
108111
chai
109112
.request(app)
@@ -118,6 +121,7 @@ describe("Contributions", function () {
118121
return done();
119122
});
120123
});
124+
121125
it("Should respond empty object when user has no pr and task available", function (done) {
122126
sinon.stub(githubService, "fetchPRsByUser").returns(githubPRInfo.userWithNoPrs);
123127
chai

test/integration/discord.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ describe("test discord actions", function () {
8888
];
8989
await Promise.all(addGroupRolesPromises);
9090
});
91+
9192
afterEach(async function () {
9293
await cleanDb();
9394
});

test/integration/discordactions.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ describe("Discord actions", function () {
6464
let discordId = "";
6565
let fetchStub;
6666
let jwt;
67+
6768
beforeEach(async function () {
6869
fetchStub = sinon.stub(global, "fetch");
6970
userId = await addUser(userData[0]);
@@ -106,6 +107,7 @@ describe("Discord actions", function () {
106107
return done();
107108
});
108109
});
110+
109111
it("Should throw error if failed to update a picture", function (done) {
110112
fetchStub.returns(
111113
Promise.resolve({
@@ -132,6 +134,7 @@ describe("Discord actions", function () {
132134
describe("GET /discord-actions/groups", function () {
133135
let newGroupData;
134136
let allIds = [];
137+
135138
before(async function () {
136139
const addUsersPromises = userData.map((user) => userModel.add({ ...user }));
137140
const responses = await Promise.all(addUsersPromises);
@@ -209,6 +212,7 @@ describe("Discord actions", function () {
209212

210213
describe("POST /discord-actions/roles", function () {
211214
let roleid;
215+
212216
beforeEach(async function () {
213217
const discordRoleModelPromise = [
214218
discordRoleModel.add(groupData[0]),
@@ -224,6 +228,7 @@ describe("Discord actions", function () {
224228
sinon.restore();
225229
await cleanDb();
226230
});
231+
227232
it("should not be able to add role if it is not a group type role", async function () {
228233
const fetchStub = sinon.stub(discordRolesModel, "isGroupRoleExists");
229234

@@ -257,6 +262,7 @@ describe("Discord actions", function () {
257262

258263
fetchStub.restore();
259264
});
265+
260266
it("should allow role to be added", async function () {
261267
fetchStub.returns(
262268
Promise.resolve({
@@ -275,6 +281,7 @@ describe("Discord actions", function () {
275281
expect(res.body).to.be.an("object");
276282
expect(res.body.message).to.equal("Role added successfully!");
277283
});
284+
278285
it("should create a reason and pass it down to the bot, on adding the role to the user", async function () {
279286
fetchStub.returns(
280287
Promise.resolve({
@@ -298,6 +305,7 @@ describe("Discord actions", function () {
298305
`Action initiator's username=>ankur and id=${userId}`
299306
);
300307
});
308+
301309
it("should not allow unknown role to be added to user", async function () {
302310
const res = await chai
303311
.request(app)
@@ -309,6 +317,7 @@ describe("Discord actions", function () {
309317
expect(res.body).to.be.an("object");
310318
expect(res.body.message).to.equal("Permission denied. Cannot add the role.");
311319
});
320+
312321
it("should not allow role to be added when userid does not belong to authenticated user", async function () {
313322
const res = await chai
314323
.request(app)
@@ -321,6 +330,7 @@ describe("Discord actions", function () {
321330
expect(res.body.message).to.equal("Permission denied. Cannot add the role.");
322331
});
323332
});
333+
324334
describe("DELETE /discord-actions/roles", function () {
325335
let roleid;
326336

@@ -385,6 +395,7 @@ describe("Discord actions", function () {
385395
`Action initiator's username=>ankur and id=${userId}`
386396
);
387397
});
398+
388399
it("should not allow unknown role to be deleted from user", async function () {
389400
const res = await chai
390401
.request(app)
@@ -396,6 +407,7 @@ describe("Discord actions", function () {
396407
expect(res.body).to.be.an("object");
397408
expect(res.body.message).to.equal("Permission denied. Cannot delete the role.");
398409
});
410+
399411
it("should not allow role to be deleted when userid does not belong to authenticated user", async function () {
400412
const res = await chai
401413
.request(app)
@@ -407,6 +419,7 @@ describe("Discord actions", function () {
407419
expect(res.body).to.be.an("object");
408420
expect(res.body.message).to.equal("Permission denied. Cannot delete the role.");
409421
});
422+
410423
it("should handle internal server error", function (done) {
411424
chai
412425
.request(app)
@@ -472,6 +485,7 @@ describe("Discord actions", function () {
472485

473486
describe("POST /discord-actions/nickname/status", function () {
474487
let jwtToken;
488+
475489
beforeEach(async function () {
476490
const userData2 = { ...userData[1] };
477491
delete userData2.discordId;
@@ -562,6 +576,7 @@ describe("Discord actions", function () {
562576
});
563577
}).timeout(10000);
564578
});
579+
565580
describe("POST /discord-actions/discord-roles", function () {
566581
before(async function () {
567582
const value = [discordRoleModel.add(groupData[0]), discordRoleModel.add(groupData[1])];
@@ -596,6 +611,7 @@ describe("Discord actions", function () {
596611

597612
describe("PUT /discord-actions/group-idle-7d", function () {
598613
let allIds;
614+
599615
beforeEach(async function () {
600616
userData[0].roles = { archived: false };
601617
userData[1].roles = { archived: false };
@@ -695,6 +711,7 @@ describe("Discord actions", function () {
695711
})
696712
);
697713
});
714+
698715
afterEach(async function () {
699716
sinon.restore();
700717
await cleanDb();

test/integration/events.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ describe("events", function () {
245245
let service;
246246
let superUserAuthToken;
247247
let memberAuthToken;
248+
248249
beforeEach(async function () {
249250
const superUser = userData[4];
250251
const member = userData[6];
@@ -483,6 +484,7 @@ describe("events", function () {
483484
let service;
484485
let superUserAuthToken;
485486
let memberAuthToken;
487+
486488
beforeEach(async function () {
487489
const superUser = userData[4];
488490
const member = userData[6];
@@ -552,6 +554,7 @@ describe("events", function () {
552554
describe("POST /events/:id/codes", function () {
553555
let service;
554556
let superUserAuthToken;
557+
555558
beforeEach(async function () {
556559
const superUser = userData[4];
557560
const superUserId = await addUser(superUser);
@@ -674,6 +677,7 @@ describe("events", function () {
674677
describe("GET /events/:id/codes - getEventCodes", function () {
675678
let service;
676679
let superUserAuthToken;
680+
677681
beforeEach(async function () {
678682
const superUser = userData[4];
679683
const superUserId = await addUser(superUser);
@@ -728,6 +732,7 @@ describe("events", function () {
728732
let service;
729733
let superUserAuthToken;
730734
let memberAuthToken;
735+
731736
beforeEach(async function () {
732737
const superUser = userData[4];
733738
const member = userData[6];

test/integration/extensionRequests.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ describe("Extension Requests", function () {
212212
return done();
213213
});
214214
});
215+
215216
it("should return success response and all extension requests with query params", function (done) {
216217
chai
217218
.request(app)
@@ -283,6 +284,7 @@ describe("Extension Requests", function () {
283284
return done();
284285
});
285286
});
287+
286288
it("Should return success response after adding the extension request (sending assignee username)", function (done) {
287289
chai
288290
.request(app)
@@ -310,6 +312,7 @@ describe("Extension Requests", function () {
310312
return done();
311313
});
312314
});
315+
313316
it("Should return failure response after adding the extension request (sending wrong assignee info)", function (done) {
314317
chai
315318
.request(app)
@@ -333,6 +336,7 @@ describe("Extension Requests", function () {
333336
return done();
334337
});
335338
});
339+
336340
it("Should return fail response if someone try to create a extension request for someone else and is not a super user", function (done) {
337341
chai
338342
.request(app)
@@ -360,6 +364,7 @@ describe("Extension Requests", function () {
360364
return done();
361365
});
362366
});
367+
363368
it("Should return fail response if task with the taskId doesn't exists", function (done) {
364369
chai
365370
.request(app)
@@ -385,6 +390,7 @@ describe("Extension Requests", function () {
385390
return done();
386391
});
387392
});
393+
388394
it("Should return fail response if task belongs to someone else", function (done) {
389395
chai
390396
.request(app)
@@ -410,6 +416,7 @@ describe("Extension Requests", function () {
410416
return done();
411417
});
412418
});
419+
413420
it("Should return fail response if the new ETA falls before old ETA", function (done) {
414421
chai
415422
.request(app)
@@ -434,6 +441,7 @@ describe("Extension Requests", function () {
434441
return done();
435442
});
436443
});
444+
437445
it("Should return fail response if extension request for a task already exists", function (done) {
438446
chai
439447
.request(app)
@@ -458,6 +466,7 @@ describe("Extension Requests", function () {
458466
return done();
459467
});
460468
});
469+
461470
it("Should return success response after adding the extension request and also there should be a log for the same", function (done) {
462471
chai
463472
.request(app)
@@ -524,6 +533,7 @@ describe("Extension Requests", function () {
524533
return done();
525534
});
526535
});
536+
527537
it("should return failure response if no extension request found with :id", function (done) {
528538
chai
529539
.request(app)
@@ -861,6 +871,7 @@ describe("Extension Requests", function () {
861871
return null;
862872
});
863873
});
874+
864875
it("Extension request log should contain extensionRequestId upon denying request", function (done) {
865876
chai
866877
.request(app)
@@ -898,6 +909,7 @@ describe("Extension Requests", function () {
898909
});
899910
});
900911
});
912+
901913
describe("Updating extension request detail", function () {
902914
it("Should create a log when SU changes the extension request's title", async function () {
903915
const newTitle = "new-title";

test/integration/external-accounts.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ describe("External Accounts", function () {
356356
rdsDiscordServerUsers: 3,
357357
});
358358
});
359+
359360
it("Should Un-Archive Users With Archived as True and in RDS Discord Server", async function () {
360361
await userModel.add(usersFromRds[2]); // archivedAndInDiscord
361362

test/integration/fcmToken.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe("Fcm Token Test", function () {
1717
userId0 = await addUser(userData0);
1818
userIdToken0 = authService.generateAuthToken({ userId: userId0 });
1919
});
20+
2021
afterEach(async function () {
2122
await cleanDb();
2223
});
@@ -58,6 +59,7 @@ describe("Fcm Token Test", function () {
5859
expect(response).to.have.status(409);
5960
expect(response.body.message).equals("Device Already Registered");
6061
});
62+
6163
it("should have fcm token", async function () {
6264
const fcmTokenData = {};
6365
const response = await chai
@@ -70,6 +72,7 @@ describe("Fcm Token Test", function () {
7072
expect(response).to.have.status(400);
7173
expect(response.body.message).equals('"fcmToken" is required');
7274
});
75+
7376
it("should have user token", async function () {
7477
const fcmTokenData = { fcmToken: "iedsijdsdj" };
7578

0 commit comments

Comments
 (0)