diff --git a/ui/src/worker/__mocks__/helper.ts b/ui/src/worker/__mocks__/helper.ts new file mode 100644 index 0000000000..6ff4b63ff4 --- /dev/null +++ b/ui/src/worker/__mocks__/helper.ts @@ -0,0 +1,26 @@ +import type { Result } from "../../generated/schema.ts"; +import { getTestResult } from "../../test/testhelper.ts"; + +export class GsaInstance { + log: any; + + private constructor(_worker: any, log: any) { + this.log = log; + } + + static async create(_log: (line: string) => void): Promise { + return new GsaInstance({}, {}); + } + + async analyze(filename: string, _data: Uint8Array): Promise { + if (filename === "fail") { + return null; + } + + for (let i = 0; i < 10; i++) { + this.log(`Processing ${i}`); + } + + return getTestResult(); + } +}