Openstatus www.openstatus.dev

🥰 small improvments (#438)

* 🥰 small improvments

* 🥰 small improvments

authored by

Thibault Le Ouay and committed by
GitHub
122fde37 d1ec46d5

+83 -6
+69
apps/server/src/checker/checker.test.ts
··· 75 75 } 76 76 expect(fn).toHaveBeenCalledTimes(0); 77 77 }); 78 + 79 + test("When 404 we should trigger alerting ", async () => { 80 + const fn = mock(() => {}); 81 + const fn1 = mock(() => {}); 82 + const fn2 = mock(() => {}); 83 + 84 + mock.module("./alerting.ts", () => { 85 + return { 86 + updateMonitorStatus: fn, 87 + triggerAlerting: fn1, 88 + }; 89 + }); 90 + mock.module("./ping.ts", () => { 91 + return { 92 + publishPing: fn2, 93 + }; 94 + }); 95 + try { 96 + await checkerRetryPolicy({ 97 + workspaceId: "1", 98 + monitorId: "1", 99 + url: "https://www.openstat.us/404", 100 + cronTimestamp: 1, 101 + status: "active", 102 + pageIds: [], 103 + method: "GET", 104 + }); 105 + } catch (e) { 106 + expect(e).toBeInstanceOf(Error); 107 + } 108 + expect(fn).toHaveBeenCalledTimes(1); 109 + expect(fn1).toHaveBeenCalledTimes(1); 110 + expect(fn2).toHaveBeenCalledTimes(1); 111 + }); 112 + 113 + test("When error 404 we should not trigger alerting ", async () => { 114 + const fn = mock(() => {}); 115 + const fn1 = mock(() => {}); 116 + const fn2 = mock(() => {}); 117 + 118 + mock.module("./alerting.ts", () => { 119 + return { 120 + updateMonitorStatus: fn, 121 + triggerAlerting: fn1, 122 + }; 123 + }); 124 + 125 + mock.module("./ping.ts", () => { 126 + return { 127 + publishPing: fn2, 128 + }; 129 + }); 130 + try { 131 + await checkerRetryPolicy({ 132 + workspaceId: "1", 133 + monitorId: "1", 134 + url: "https://www.openstat.us/404", 135 + cronTimestamp: 1, 136 + status: "error", 137 + pageIds: [], 138 + method: "GET", 139 + }); 140 + } catch (e) { 141 + expect(e).toBeInstanceOf(Error); 142 + } 143 + expect(fn).toHaveBeenCalledTimes(0); 144 + expect(fn1).toHaveBeenCalledTimes(0); 145 + expect(fn2).toHaveBeenCalledTimes(1); 146 + });
+6 -1
apps/server/src/v1/incident.ts
··· 60 60 const getAllRoute = createRoute({ 61 61 method: "get", 62 62 tags: ["incident"], 63 + description: "Get all incidents", 63 64 path: "/", 64 65 request: {}, 65 66 responses: { ··· 108 109 const getRoute = createRoute({ 109 110 method: "get", 110 111 tags: ["incident"], 112 + description: "Get an incident", 111 113 path: "/:id", 112 114 request: { 113 115 params: ParamsSchema, ··· 162 164 const postRoute = createRoute({ 163 165 method: "post", 164 166 tags: ["incident"], 167 + description: "Create an incident", 165 168 path: "/", 166 169 request: { 167 170 body: { ··· 214 217 const deleteRoute = createRoute({ 215 218 method: "delete", 216 219 tags: ["incident"], 220 + description: "Delete an incident", 217 221 path: "/:id", 218 222 request: { 219 223 params: ParamsSchema, ··· 266 270 method: "post", 267 271 tags: ["incident"], 268 272 path: "/:id/update", 273 + description: "Create an incident update", 269 274 request: { 270 275 params: ParamsSchema, 271 276 body: { 272 - description: "The incident to update", 277 + description: "the incident update", 273 278 content: { 274 279 "application/json": { 275 280 schema: incidentUpdateSchema,
+7 -2
apps/server/src/v1/monitor.ts
··· 153 153 const getAllRoute = createRoute({ 154 154 method: "get", 155 155 tags: ["monitor"], 156 + description: "Get all monitors", 156 157 path: "/", 157 158 request: {}, 158 159 responses: { ··· 162 163 schema: z.array(MonitorSchema), 163 164 }, 164 165 }, 165 - description: "Get the monitor", 166 + description: "All the monitors", 166 167 }, 167 168 404: { 168 169 content: { ··· 201 202 const getRoute = createRoute({ 202 203 method: "get", 203 204 tags: ["monitor"], 205 + description: "Get a monitor", 204 206 path: "/:id", 205 207 request: { 206 208 params: ParamsSchema, ··· 212 214 schema: MonitorSchema, 213 215 }, 214 216 }, 215 - description: "Get the monitor", 217 + description: "The monitor", 216 218 }, 217 219 401: { 218 220 content: { ··· 258 260 const postRoute = createRoute({ 259 261 method: "post", 260 262 tags: ["monitor"], 263 + description: "Create a monitor", 261 264 path: "/", 262 265 request: { 263 266 body: { ··· 332 335 const putRoute = createRoute({ 333 336 method: "put", 334 337 tags: ["monitor"], 338 + description: "Update a monitor", 335 339 path: "/:id", 336 340 request: { 337 341 params: ParamsSchema, ··· 404 408 const deleteRoute = createRoute({ 405 409 method: "delete", 406 410 tags: ["monitor"], 411 + description: "Delete a monitor", 407 412 path: "/:id", 408 413 request: { 409 414 params: ParamsSchema,
+1 -3
packages/emails/emails/waiting-list.tsx
··· 5 5 <Html> 6 6 <Head> 7 7 <title>Thanks for joining OpenStatus waiting list</title> 8 - <Preview> 9 - Thanks for joining OpenStatus waiting list 10 - </Preview> 8 + <Preview>Thanks for joining OpenStatus waiting list</Preview> 11 9 <Body> 12 10 Hello, 13 11 <br />