Skip to content

Open-source status page, incident response and uptime monitoring

🧪 fixed tests (#624)

Kushagra Sharma57dabdb06974
diff --git a/apps/server/src/v1/monitor.test.ts b/apps/server/src/v1/monitor.test.ts
index 4835126ab..ed7271076 100644
--- a/apps/server/src/v1/monitor.test.ts
+++ b/apps/server/src/v1/monitor.test.ts
@@ -212,7 +212,7 @@ test("Update a monitor without auth key should return 401", async () => {
headers: [{ key: "key", value: "value" }],
active: true,
};
- const res = await api.request("/monitor/3", {
+ const res = await api.request("/monitor/2", {
method: "PUT",
headers: {
"content-type": "application/json",
@@ -233,7 +233,7 @@ test("Update a monitor with invalid data should return 403", async () => {
headers: [{ key: "key", value: "value" }],
active: true,
};
- const res = await api.request("/monitor/3", {
+ const res = await api.request("/monitor/2", {
method: "PUT",
headers: {
"x-openstatus-key": "1",
diff --git a/apps/server/src/v1/statusReport.test.ts b/apps/server/src/v1/statusReport.test.ts
index ffd5bf844..76dfd96a9 100644
--- a/apps/server/src/v1/statusReport.test.ts
+++ b/apps/server/src/v1/statusReport.test.ts
@@ -85,7 +85,7 @@ test("Get all status report", async () => {
});
test("Delete a status report", async () => {
- const res = await api.request("/status_report/1", {
+ const res = await api.request("/status_report/2", {
method: "DELETE",
headers: {
"x-openstatus-key": "1",
@@ -98,7 +98,7 @@ test("Delete a status report", async () => {
});
test("create a status report update", async () => {
- const res = await api.request("/status_report/2/update", {
+ const res = await api.request("/status_report/3/update", {
method: "POST",
headers: {
"x-openstatus-key": "1",
@@ -113,7 +113,7 @@ test("create a status report update", async () => {
expect(res.status).toBe(200);
expect(await res.json()).toMatchObject({
status: "investigating",
- id: "1",
+ id: "3",
date: "Wed Nov 08 2023 21:03:13 GMT+0000 (Coordinated Universal Time)",
message: "Test Status Report",
});
@@ -140,7 +140,7 @@ test("Create a status report update not in db should return 404", async () => {
});
test("Create a status report update without auth key should return 401", async () => {
- const res = await api.request("/status_report/2/update", {
+ const res = await api.request("/status_report/1/update", {
method: "POST",
headers: {
//not having the key returns unauthorized
@@ -156,7 +156,7 @@ test("Create a status report update without auth key should return 401", async (
});
test("Create a status report update with invalid data should return 403", async () => {
- const res = await api.request("/status_report/2/update", {
+ const res = await api.request("/status_report/1/update", {
method: "POST",
headers: {
"x-openstatus-key": "1",
diff --git a/packages/db/src/seed.mts b/packages/db/src/seed.mts
index d88bf8f6c..0b414dffb 100644
--- a/packages/db/src/seed.mts
+++ b/packages/db/src/seed.mts
@@ -146,6 +146,28 @@ async function main() {
})
.run();
+ await db
+ .insert(statusReport)
+ .values({
+ id: 2,
+ workspaceId: 1,
+ title: "Test Status Report",
+ status: "investigating",
+ updatedAt: new Date(),
+ })
+ .run();
+
+ await db
+ .insert(statusReport)
+ .values({
+ id: 3,
+ workspaceId: 1,
+ title: "Test Status Report",
+ status: "investigating",
+ updatedAt: new Date(),
+ })
+ .run();
+
await db
.insert(incidentTable)
.values({