qa: add e2e tests

This commit is contained in:
Morten Olsen
2024-01-17 00:16:21 +01:00
parent e5064ca905
commit d3ad83ddf7
68 changed files with 1560 additions and 583 deletions

View File

@@ -1,6 +1,7 @@
import { CronJob } from 'cron';
import { ScheduleRepo } from '../repos/schedules/schedules.js';
import { RunRepo } from '../repos/runs/runs.js';
import { ContainerInstance, Service } from 'typedi';
type SchedulerOptions = {
runs: RunRepo;
@@ -13,12 +14,16 @@ type RunningSchedule = {
stop: () => Promise<void>;
};
@Service()
class Scheduler {
#running: RunningSchedule[] = [];
#options: SchedulerOptions;
constructor(options: SchedulerOptions) {
this.#options = options;
constructor(container: ContainerInstance) {
this.#options = {
runs: container.get(RunRepo),
schedules: container.get(ScheduleRepo),
};
const { schedules } = this.#options;
schedules.on('added', this.#add);
schedules.on('removed', this.#remove);