This commit is contained in:
Alex Holliday committed 2025-07-21 10:34:16 -07:00
1 parent 846564a17e
commit bfa6832beb
83 files changed
+338 -1249

No files matched your search

+1 -7
View File
@@ -51,13 +51,7 @@ describe("NormalizeData", function () {
describe("calculatePercentile", function () {
it("should return the lower value when upper is greater than or equal to the length of the sorted array", function () {
const checks = [
{ responseTime: 10 },
{ responseTime: 20 },
{ responseTime: 30 },
{ responseTime: 40 },
{ responseTime: 50 },
];
const checks = [{ responseTime: 10 }, { responseTime: 20 }, { responseTime: 30 }, { responseTime: 40 }, { responseTime: 50 }];
const percentile = 100;
const result = calculatePercentile(checks, percentile);
+2 -6
View File
@@ -12,9 +12,7 @@ describe("imageProcessing - GenerateAvatarImage", function () {
// Stub the sharp function
const toBufferStub = sinon.stub().resolves(Buffer.from("resized image buffer"));
const resizeStub = sinon.stub().returns({ toBuffer: toBufferStub });
const sharpStub = sinon
.stub(sharp.prototype, "resize")
.returns({ toBuffer: toBufferStub });
const sharpStub = sinon.stub(sharp.prototype, "resize").returns({ toBuffer: toBufferStub });
const result = await GenerateAvatarImage(file);
@@ -38,9 +36,7 @@ describe("imageProcessing - GenerateAvatarImage", function () {
// Stub the sharp function to throw an error
const toBufferStub = sinon.stub().rejects(new Error("Resizing failed"));
const resizeStub = sinon.stub().returns({ toBuffer: toBufferStub });
const sharpStub = sinon
.stub(sharp.prototype, "resize")
.returns({ toBuffer: toBufferStub });
const sharpStub = sinon.stub(sharp.prototype, "resize").returns({ toBuffer: toBufferStub });
try {
await GenerateAvatarImage(file);
+3 -9
View File
@@ -3,25 +3,19 @@ describe("Messages", function () {
describe("messages - errorMessages", function () {
it("should have a DB_FIND_MONITOR_BY_ID function", function () {
const monitorId = "12345";
expect(errorMessages.DB_FIND_MONITOR_BY_ID(monitorId)).to.equal(
`Monitor with id ${monitorId} not found`
);
expect(errorMessages.DB_FIND_MONITOR_BY_ID(monitorId)).to.equal(`Monitor with id ${monitorId} not found`);
});
it("should have a DB_DELETE_CHECKS function", function () {
const monitorId = "12345";
expect(errorMessages.DB_DELETE_CHECKS(monitorId)).to.equal(
`No checks found for monitor with id ${monitorId}`
);
expect(errorMessages.DB_DELETE_CHECKS(monitorId)).to.equal(`No checks found for monitor with id ${monitorId}`);
});
});
describe("messages - successMessages", function () {
it("should have a MONITOR_GET_BY_USER_ID function", function () {
const userId = "12345";
expect(successMessages.MONITOR_GET_BY_USER_ID(userId)).to.equal(
`Got monitor for ${userId} successfully"`
);
expect(successMessages.MONITOR_GET_BY_USER_ID(userId)).to.equal(`Got monitor for ${userId} successfully"`);
});
// Add more tests for other success messages as needed