From 5dbd16878546886cae5b56b67de6185bfbae0d07 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 1 Aug 2024 09:15:33 -0700 Subject: add arg parser --- src/canary/test.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/canary/test.ts (limited to 'src/canary/test.ts') 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 = (job: T) => TE.TaskEither; + +export const parseTestType = (testType: string): O.Option => + Object.values(TestType).includes(testType as TestType) + ? O.some(testType as TestType) + : O.none; -- cgit v1.3