Migrate tests to ESM

This commit is contained in:
Alex Holliday committed 2024-10-15 14:00:24 +08:00
1 parent f057807b56
commit 896b3437e5
22 files changed
+1153 -238

No files matched your search

@@ -1,13 +1,14 @@
const { afterEach } = require("node:test");
const {
import { afterEach } from "node:test";
import {
getAppSettings,
updateAppSettings,
} = require("../../controllers/settingsController");
} from "../../controllers/settingsController.js";
const { errorMessages, successMessages } = require("../../utils/messages");
const sinon = require("sinon");
import { successMessages } from "../../utils/messages.js";
import sinon from "sinon";
describe("Settings Controller - getAppSettings", () => {
let req, res, next;
beforeEach(() => {
req = {
headers: {},
@@ -23,7 +24,6 @@ describe("Settings Controller - getAppSettings", () => {
json: sinon.stub(),
};
next = sinon.stub();
handleError = sinon.stub();
});
afterEach(() => {
sinon.restore();
@@ -49,6 +49,7 @@ describe("Settings Controller - getAppSettings", () => {
});
describe("Settings Controller - updateAppSettings", () => {
let req, res, next;
beforeEach(() => {
req = {
headers: {},
@@ -66,7 +67,6 @@ describe("Settings Controller - updateAppSettings", () => {
json: sinon.stub(),
};
next = sinon.stub();
handleError = sinon.stub();
});
afterEach(() => {
sinon.restore();