aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/comlink/comlink.test.ts
blob: 77d81095048e76876b74036ce3903c51336ec377 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { test, expect, describe } from "bun:test";
import { join } from "path";
import * as Comlink from "comlink";

describe("comlink", () => {
  test("should start without big delay", async () => {
    const worker = new Worker(join(import.meta.dir, "worker.fixture.ts"));
    const obj = Comlink.wrap(worker);
    const start = performance.now();
    //@ts-ignore
    await obj.counter;
    const end = performance.now();
    expect(end - start).toBeLessThan(100);
  });
});