Skip to content

Commit

Permalink
chore: Simplified test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Dec 5, 2024
1 parent 23c568f commit 3c3fd21
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
11 changes: 9 additions & 2 deletions packages/api/src/repositories/jobs.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import {
ffmpegQueue,
ffprobeQueue,
flowProducer,
outcomeQueue,
packageQueue,
pipelineQueue,
transcodeQueue,
} from "bolt";
import { Job as RawJob } from "bullmq";
import { FlowProducer, Job as RawJob } from "bullmq";
import { env } from "../env";
import { isRecordWithNumbers } from "../utils/type-guard";
import type { Job } from "../types";
import type { JobNode, JobState, Queue } from "bullmq";

const flowProducer = new FlowProducer({
connection: {
host: env.REDIS_HOST,
port: env.REDIS_PORT,
},
});

const allQueus = [
pipelineQueue,
transcodeQueue,
Expand Down
13 changes: 4 additions & 9 deletions packages/artisan/test/setup.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { mock } from "bun:test";

// We're going to mock bolt entirely as we do not want job runners
// to actually do work during tests.
mock.module("bolt", () => ({
getChildren: () => [],
waitForChildren: () => Promise.resolve(),
outcomeQueue: undefined,
ffmpegQueue: undefined,
ffprobeQueue: undefined,
addToQueue: undefined,
mock.module("bullmq", () => ({
Queue: class {},
Worker: class {},
WaitingChildrenError: class {},
}));

process.env = {
Expand Down
6 changes: 0 additions & 6 deletions packages/bolt/src/add-to-queue.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { randomUUID } from "crypto";
import { FlowProducer } from "bullmq";
import { connection } from "./env";
import type { Job, JobsOptions, Queue } from "bullmq";

export const flowProducer = new FlowProducer({
connection,
});

export const DEFAULT_SEGMENT_SIZE = 2.24;

export const DEFAULT_PACKAGE_NAME = "hls";
Expand Down
3 changes: 0 additions & 3 deletions scripts/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { $ } from "bun";
import { buildClientPackages } from "./devtools/client-packages";

await buildClientPackages();

await $`bun run --filter="*" test`;

0 comments on commit 3c3fd21

Please sign in to comment.