fix(test): Use 'npm run lint-fix' to fix 'mocha/no-mocha-arrows' like lint warnings
- ref: https://mochajs.org/#arrow-functions
This commit is contained in:
1 parent
319e6d6017
commit
fcda60fe5b
31 files changed
+1268
-907
No files matched your search
@@ -4,9 +4,10 @@ import {
|
||||
getStatusPageByUrl,
|
||||
} from "../../controllers/statusPageController.js";
|
||||
|
||||
describe("statusPageController", () => {
|
||||
describe("statusPageController", function() {
|
||||
let req, res, next;
|
||||
beforeEach(() => {
|
||||
|
||||
beforeEach(function() {
|
||||
req = {
|
||||
params: {},
|
||||
body: {},
|
||||
@@ -22,12 +23,12 @@ describe("statusPageController", () => {
|
||||
next = sinon.stub();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
afterEach(function() {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
describe("createStatusPage", () => {
|
||||
beforeEach(() => {
|
||||
describe("createStatusPage", function() {
|
||||
beforeEach(function() {
|
||||
req.body = {
|
||||
companyName: "Test Company",
|
||||
url: "123456",
|
||||
@@ -38,11 +39,11 @@ describe("statusPageController", () => {
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
afterEach(function() {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it("should handle a validation error", async () => {
|
||||
it("should handle a validation error", async function() {
|
||||
req.body = {
|
||||
// Invalid data that will trigger validation error
|
||||
companyName: "",
|
||||
@@ -60,7 +61,7 @@ describe("statusPageController", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("should handle a db error", async () => {
|
||||
it("should handle a db error", async function() {
|
||||
const err = new Error("DB error");
|
||||
req.db.createStatusPage.throws(err);
|
||||
|
||||
@@ -71,24 +72,25 @@ describe("statusPageController", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("should insert a properly formatted status page", async () => {
|
||||
it("should insert a properly formatted status page", async function() {
|
||||
const result = await createStatusPage(req, res, next);
|
||||
expect(res.status.firstCall.args[0]).to.equal(200);
|
||||
expect(res.json.firstCall.args[0].success).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe("getStatusPageByUrl", () => {
|
||||
beforeEach(() => {
|
||||
describe("getStatusPageByUrl", function() {
|
||||
beforeEach(function() {
|
||||
req.params = {
|
||||
url: "123456",
|
||||
};
|
||||
});
|
||||
afterEach(() => {
|
||||
|
||||
afterEach(function() {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it("should handle a validation error", async () => {
|
||||
it("should handle a validation error", async function() {
|
||||
req.params = {
|
||||
url: "",
|
||||
};
|
||||
@@ -101,7 +103,7 @@ describe("statusPageController", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("should handle a DB error", async () => {
|
||||
it("should handle a DB error", async function() {
|
||||
const err = new Error("DB error");
|
||||
req.db.getStatusPageByUrl.throws(err);
|
||||
|
||||
@@ -112,7 +114,7 @@ describe("statusPageController", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("should return a status page", async () => {
|
||||
it("should return a status page", async function() {
|
||||
const statusPage = {
|
||||
_id: "123456",
|
||||
companyName: "Test Company",
|
||||
|
||||
Reference in new issue
Block a user