aboutsummaryrefslogtreecommitdiff
path: root/src/canary/test.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth@simponic.xyz>2024-08-01 09:15:33 -0700
committerElizabeth Hunt <elizabeth@simponic.xyz>2024-08-01 09:15:33 -0700
commit5dbd16878546886cae5b56b67de6185bfbae0d07 (patch)
tree8dd29c83d8f56b254d964ec040be9bcea0bc108b /src/canary/test.ts
parentad74ff999589e0df2b60ba6e94362ed5215af312 (diff)
downloadmon.hatecomputers.club-5dbd16878546886cae5b56b67de6185bfbae0d07.tar.gz
mon.hatecomputers.club-5dbd16878546886cae5b56b67de6185bfbae0d07.zip
add arg parser
Diffstat (limited to 'src/canary/test.ts')
-rw-r--r--src/canary/test.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/canary/test.ts b/src/canary/test.ts
new file mode 100644
index 0000000..c03fb30
--- /dev/null
+++ b/src/canary/test.ts
@@ -0,0 +1,30 @@
+import * as TE from "fp-ts/lib/TaskEither";
+import * as O from "fp-ts/lib/Option";
+import type { Job } from "./job";
+import type { D } from "../util";
+
+export enum TestType {
+ EMAIL = "email",
+ PING = "ping",
+ HEALTHCHECK = "healthcheck",
+ DNS = "dns",
+}
+
+export interface Schedule {
+ every: D.Duration;
+ jitter: D.Duration;
+}
+
+export interface Test {
+ name: string;
+ type: TestType;
+ job: Job;
+ schedule: Schedule;
+}
+
+export type Testable<T extends Job> = (job: T) => TE.TaskEither<Error, boolean>;
+
+export const parseTestType = (testType: string): O.Option<TestType> =>
+ Object.values(TestType).includes(testType as TestType)
+ ? O.some(testType as TestType)
+ : O.none;