mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-10 21:55:19 +00:00
Use flushPromises for readability
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
|||||||
|
|
||||||
import { applyProcessor, trackProcessorSync } from "./TrackProcessorContext";
|
import { applyProcessor, trackProcessorSync } from "./TrackProcessorContext";
|
||||||
import { constant } from "../state/Behavior";
|
import { constant } from "../state/Behavior";
|
||||||
import { testScope } from "../utils/test";
|
import { flushPromises, testScope } from "../utils/test";
|
||||||
|
|
||||||
const processor = {} as ProcessorWrapper<BackgroundOptions>;
|
const processor = {} as ProcessorWrapper<BackgroundOptions>;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ describe("applyProcessor", () => {
|
|||||||
const unhandled = vi.fn();
|
const unhandled = vi.fn();
|
||||||
process.on("unhandledRejection", unhandled);
|
process.on("unhandledRejection", unhandled);
|
||||||
applyProcessor(track, processor);
|
applyProcessor(track, processor);
|
||||||
await new Promise((r) => setTimeout(r, 0));
|
await flushPromises();
|
||||||
process.off("unhandledRejection", unhandled);
|
process.off("unhandledRejection", unhandled);
|
||||||
expect(unhandled).not.toHaveBeenCalled();
|
expect(unhandled).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -68,7 +68,7 @@ describe("applyProcessor", () => {
|
|||||||
const unhandled = vi.fn();
|
const unhandled = vi.fn();
|
||||||
process.on("unhandledRejection", unhandled);
|
process.on("unhandledRejection", unhandled);
|
||||||
applyProcessor(track, undefined);
|
applyProcessor(track, undefined);
|
||||||
await new Promise((r) => setTimeout(r, 0));
|
await flushPromises();
|
||||||
process.off("unhandledRejection", unhandled);
|
process.off("unhandledRejection", unhandled);
|
||||||
expect(unhandled).not.toHaveBeenCalled();
|
expect(unhandled).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user