fix: revert tests

This commit is contained in:
cihatata authored and cihat committed 2025-02-11 07:43:39 +03:00
1 parent dea8c4fdd8
commit 08933743f1
12 files changed
+617 -645

No files matched your search

@@ -8,10 +8,10 @@ import {
import { successMessages } from "../../utils/messages.js";
import sinon from "sinon";
describe("Queue Controller - getMetrics", function () {
describe("Queue Controller - getMetrics", function() {
let req, res, next;
beforeEach(function () {
beforeEach(function() {
req = {
headers: {},
params: {},
@@ -32,14 +32,14 @@ describe("Queue Controller - getMetrics", function () {
sinon.restore();
});
it("should throw an error if getMetrics throws an error", async function () {
it("should throw an error if getMetrics throws an error", async function() {
req.jobQueue.getMetrics.throws(new Error("getMetrics error"));
await getMetrics(req, res, next);
expect(next.firstCall.args[0]).to.be.an("error");
expect(next.firstCall.args[0].message).to.equal("getMetrics error");
});
it("should return a success message and data if getMetrics is successful", async function () {
it("should return a success message and data if getMetrics is successful", async function() {
const data = { data: "metrics" };
req.jobQueue.getMetrics.returns(data);
await getMetrics(req, res, next);
@@ -52,10 +52,10 @@ describe("Queue Controller - getMetrics", function () {
});
});
describe("Queue Controller - getJobs", function () {
describe("Queue Controller - getJobs", function() {
let req, res, next;
beforeEach(function () {
beforeEach(function() {
req = {
headers: {},
params: {},
@@ -76,14 +76,14 @@ describe("Queue Controller - getJobs", function () {
sinon.restore();
});
it("should reject with an error if getJobs throws an error", async function () {
it("should reject with an error if getJobs throws an error", async function() {
req.jobQueue.getJobStats.throws(new Error("getJobs error"));
await getJobs(req, res, next);
expect(next.firstCall.args[0]).to.be.an("error");
expect(next.firstCall.args[0].message).to.equal("getJobs error");
});
it("should return a success message and data if getJobs is successful", async function () {
it("should return a success message and data if getJobs is successful", async function() {
const data = { data: "jobs" };
req.jobQueue.getJobStats.returns(data);
await getJobs(req, res, next);
@@ -96,10 +96,10 @@ describe("Queue Controller - getJobs", function () {
});
});
describe("Queue Controller - addJob", function () {
describe("Queue Controller - addJob", function() {
let req, res, next;
beforeEach(function () {
beforeEach(function() {
req = {
headers: {},
params: {},
@@ -120,14 +120,14 @@ describe("Queue Controller - addJob", function () {
sinon.restore();
});
it("should reject with an error if addJob throws an error", async function () {
it("should reject with an error if addJob throws an error", async function() {
req.jobQueue.addJob.throws(new Error("addJob error"));
await addJob(req, res, next);
expect(next.firstCall.args[0]).to.be.an("error");
expect(next.firstCall.args[0].message).to.equal("addJob error");
});
it("should return a success message if addJob is successful", async function () {
it("should return a success message if addJob is successful", async function() {
req.jobQueue.addJob.resolves();
await addJob(req, res, next);
expect(res.status.firstCall.args[0]).to.equal(200);
@@ -138,10 +138,10 @@ describe("Queue Controller - addJob", function () {
});
});
describe("Queue Controller - obliterateQueue", function () {
describe("Queue Controller - obliterateQueue", function() {
let req, res, next;
beforeEach(function () {
beforeEach(function() {
req = {
headers: {},
params: {},
@@ -162,14 +162,14 @@ describe("Queue Controller - obliterateQueue", function () {
sinon.restore();
});
it("should reject with an error if obliterateQueue throws an error", async function () {
it("should reject with an error if obliterateQueue throws an error", async function() {
req.jobQueue.obliterate.throws(new Error("obliterateQueue error"));
await obliterateQueue(req, res, next);
expect(next.firstCall.args[0]).to.be.an("error");
expect(next.firstCall.args[0].message).to.equal("obliterateQueue error");
});
it("should return a success message if obliterateQueue is successful", async function () {
it("should return a success message if obliterateQueue is successful", async function() {
req.jobQueue.obliterate.resolves();
await obliterateQueue(req, res, next);
expect(res.status.firstCall.args[0]).to.equal(200);