Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
📝 format
Thibault Le Ouay504578a93ff5
diff --git a/apps/server/src/v1/incidents.test.ts b/apps/server/src/v1/incidents.test.tsindex 82d79bdf7..95f842564 100644--- a/apps/server/src/v1/incidents.test.ts+++ b/apps/server/src/v1/incidents.test.ts@@ -17,7 +17,6 @@ test("GET one Incident", async () => {resolvedAt: null,resolvedBy: null,acknowledgedBy: null,-});});@@ -34,7 +33,7 @@ test("Update an incident ", async () => {});expect(res.status).toBe(200);- expect((await res.json())).toMatchObject({+ expect(await res.json()).toMatchObject({acknowledgedAt: "2023-11-08T21:03:13.000Z",monitorId: 1,id: 2,@@ -46,7 +45,8 @@ test("Update an incident ", async () => {});test("Update an incident not in db should return 404", async () => {- const res = await api.request("/incident/404", {//accessing invalid monitor+ const res = await api.request("/incident/404", {+ //accessing invalid monitormethod: "PUT",headers: {"x-openstatus-key": "1",@@ -57,16 +57,17 @@ test("Update an incident not in db should return 404", async () => {}),});expect(res.status).toBe(200);- expect((await res.json())).toMatchObject({- code: 404,- message:"Not Found"+ expect(await res.json()).toMatchObject({+ code: 404,+ message: "Not Found",});-})+});test("Update an incident without auth key should return 401", async () => {const res = await api.request("/incident/2", {method: "PUT",- headers: {//not passing correct key+ headers: {+ //not passing correct key"content-type": "application/json",},body: JSON.stringify({@@ -83,15 +84,16 @@ test("Update an incident with invalid data should return 403", async () => {"x-openstatus-key": "1","content-type": "application/json",},- body: JSON.stringify({//passing incorrect body+ body: JSON.stringify({+ //passing incorrect bodyacknowledgedAt: "2023-11-0",}),});expect(res.status).toBe(400);- expect((await res.json())).toMatchObject({- error:{+ expect(await res.json()).toMatchObject({+ error: {issues: expect.any(Array),- name: "ZodError"+ name: "ZodError",},success: false,});@@ -99,7 +101,7 @@ test("Update an incident with invalid data should return 403", async () => {test("Get all Incidents", async () => {const res = await api.request("/incident", {- method:"GET",+ method: "GET",headers: {"x-openstatus-key": "1",},@@ -114,5 +116,4 @@ test("Get all Incidents", async () => {resolvedBy: null,acknowledgedBy: null,});--});\ No newline at end of file+});diff --git a/apps/server/src/v1/monitor.test.ts b/apps/server/src/v1/monitor.test.tsindex a9e616c75..4835126ab 100644--- a/apps/server/src/v1/monitor.test.ts+++ b/apps/server/src/v1/monitor.test.ts@@ -1,4 +1,5 @@import { expect, test } from "bun:test";+import { api } from ".";test("GET one monitor", async () => {@@ -124,9 +125,9 @@ test("Create a monitor with invalid data should return 403", async () => {});expect(res.status).toBe(400);expect(await res.json()).toMatchObject({- error:{+ error: {issues: expect.any(Array),- name: "ZodError"+ name: "ZodError",},success: false,});@@ -182,7 +183,8 @@ test("Update a monitor not in db should return 404", async () => {active: true,};- const res = await api.request("/monitor/404", {//accessing wrong monitor, just returns 404+ const res = await api.request("/monitor/404", {+ //accessing wrong monitor, just returns 404method: "PUT",headers: {"x-openstatus-key": "1",@@ -194,7 +196,7 @@ test("Update a monitor not in db should return 404", async () => {expect(await res.json()).toMatchObject({code: 404,- message: "Not Found"+ message: "Not Found",});});@@ -218,10 +220,10 @@ test("Update a monitor without auth key should return 401", async () => {body: JSON.stringify(data),});expect(res.status).toBe(401);-})+});test("Update a monitor with invalid data should return 403", async () => {const data = {- periodicity: 9,//not passing correct value returns 403+ periodicity: 9, //not passing correct value returns 403url: "https://www.openstatus.dev",name: "OpenStatus",description: "OpenStatus website",@@ -241,13 +243,13 @@ test("Update a monitor with invalid data should return 403", async () => {});expect(res.status).toBe(400);expect(await res.json()).toMatchObject({- error:{+ error: {issues: expect.any(Array),- name: "ZodError"+ name: "ZodError",},success: false,});-})+});test("Delete one monitor", async () => {const res = await api.request("/monitor/3", {@@ -259,11 +261,11 @@ test("Delete one monitor", async () => {expect(res.status).toBe(200);expect(await res.json()).toMatchObject({- message: "Deleted"+ message: "Deleted",});});-test.todo("Get monitor daily Summary")+test.todo("Get monitor daily Summary");// test("Get monitor daily Summary", async () => {// const res = await api.request("/monitor/1/summary", {// headers: {@@ -278,5 +280,3 @@ test.todo("Get monitor daily Summary")// day: "31-01-2024"// });// });--diff --git a/apps/server/src/v1/statusReport.test.ts b/apps/server/src/v1/statusReport.test.tsindex 8084e3d24..ffd5bf844 100644--- a/apps/server/src/v1/statusReport.test.ts+++ b/apps/server/src/v1/statusReport.test.ts@@ -31,7 +31,7 @@ test("create one status report", async () => {expect(res.status).toBe(200);expect(await res.json()).toMatchObject({id: expect.any(Number),- status_report_updates: expect.any(Array)+ status_report_updates: expect.any(Array),});});@@ -46,7 +46,7 @@ test("Create one status report without auth key should return 401", async () =>title: "Test Status Report",}),});- expect(res.status).toBe(401);//unauthenticated+ expect(res.status).toBe(401); //unauthenticated});test("Create one status report with invalid data should return 403", async () => {@@ -56,15 +56,16 @@ test("Create one status report with invalid data should return 403", async () =>"x-openstatus-key": "1","content-type": "application/json",},- body: JSON.stringify({//passing incompelete body+ body: JSON.stringify({+ //passing incompelete bodytitle: "Test Status Report",}),});expect(res.status).toBe(400);expect(await res.json()).toMatchObject({- error:{+ error: {issues: expect.any(Array),- name: "ZodError"+ name: "ZodError",},success: false,});@@ -92,7 +93,7 @@ test("Delete a status report", async () => {});expect(res.status).toBe(200);expect(await res.json()).toMatchObject({- message:"Deleted"+ message: "Deleted",});});@@ -114,7 +115,7 @@ test("create a status report update", async () => {status: "investigating",id: "1",date: "Wed Nov 08 2023 21:03:13 GMT+0000 (Coordinated Universal Time)",- message: "Test Status Report"+ message: "Test Status Report",});});@@ -133,15 +134,16 @@ test("Create a status report update not in db should return 404", async () => {});expect(res.status).toBe(200);expect(await res.json()).toMatchObject({- code: 404,- message: "Not Found"+ code: 404,+ message: "Not Found",});});test("Create a status report update without auth key should return 401", async () => {const res = await api.request("/status_report/2/update", {method: "POST",- headers: {//not having the key returns unauthorized+ headers: {+ //not having the key returns unauthorized"content-type": "application/json",},body: JSON.stringify({@@ -160,16 +162,17 @@ test("Create a status report update with invalid data should return 403", async"x-openstatus-key": "1","content-type": "application/json",},- body: JSON.stringify({//passing in incompelete body+ body: JSON.stringify({+ //passing in incompelete bodydate: "2023-11-08T21:03:13.000Z",message: "Test Status Report",}),});expect(res.status).toBe(400);expect(await res.json()).toMatchObject({- error:{+ error: {issues: expect.any(Array),- name: "ZodError"+ name: "ZodError",},success: false,});diff --git a/apps/server/src/v1/statusReportUpdate.test.ts b/apps/server/src/v1/statusReportUpdate.test.tsindex c37c5bde0..646a701d4 100644--- a/apps/server/src/v1/statusReportUpdate.test.ts+++ b/apps/server/src/v1/statusReportUpdate.test.ts@@ -39,7 +39,8 @@ test("create one status report update ", async () => {test("create one status report update without auth key should return 401", async () => {const res = await api.request("/status_report_update", {method: "POST",- headers: {//not passing in the key+ headers: {+ //not passing in the key"content-type": "application/json",},body: JSON.stringify({@@ -50,7 +51,6 @@ test("create one status report update without auth key should return 401", async}),});expect(res.status).toBe(401);-});test("create one status report update with invalid data should return 403", async () => {@@ -60,16 +60,17 @@ test("create one status report update with invalid data should return 403", asyn"x-openstatus-key": "1","content-type": "application/json",},- body: JSON.stringify({//incompelete body+ body: JSON.stringify({+ //incompelete bodystatus: "investigating",date: "2023-11-08T21:03:13.000Z",}),});expect(res.status).toBe(400);expect(await res.json()).toMatchObject({- error:{+ error: {issues: expect.any(Array),- name: "ZodError"+ name: "ZodError",},success: false,});