diff options
Diffstat (limited to 'src/canary/test.ts')
| -rw-r--r-- | src/canary/test.ts | 30 |
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; |
