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:
Mert Şişmanoğlu committed 2024-12-29 14:25:59 +03:00
1 parent 319e6d6017
commit fcda60fe5b
31 files changed
+1268 -907

No files matched your search

+14 -9
View File
@@ -9,23 +9,26 @@ const mockAppSettings = {
appName: "Test App",
};
describe("SettingsModule", () => {
describe("SettingsModule", function() {
let appSettingsFindOneStub, appSettingsFindOneAndUpdateStub;
beforeEach(() => {
beforeEach(function() {
appSettingsFindOneStub = sinon.stub(AppSettings, "findOne");
appSettingsFindOneAndUpdateStub = sinon.stub(AppSettings, "findOneAndUpdate");
});
afterEach(() => {
afterEach(function() {
sinon.restore();
});
describe("getAppSettings", () => {
it("should return app settings", async () => {
describe("getAppSettings", function() {
it("should return app settings", async function() {
appSettingsFindOneStub.resolves(mockAppSettings);
const result = await getAppSettings();
expect(result).to.deep.equal(mockAppSettings);
});
it("should handle an error", async () => {
it("should handle an error", async function() {
const err = new Error("Test error");
appSettingsFindOneStub.throws(err);
try {
@@ -35,13 +38,15 @@ describe("SettingsModule", () => {
}
});
});
describe("updateAppSettings", () => {
it("should update app settings", async () => {
describe("updateAppSettings", function() {
it("should update app settings", async function() {
appSettingsFindOneAndUpdateStub.resolves(mockAppSettings);
const result = await updateAppSettings(mockAppSettings);
expect(result).to.deep.equal(mockAppSettings);
});
it("should handle an error", async () => {
it("should handle an error", async function() {
const err = new Error("Test error");
appSettingsFindOneAndUpdateStub.throws(err);
try {