Skip to content

Commit e97490c

Browse files
test(node-http-handler): modify test
1 parent 5718c10 commit e97490c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/node-http-handler/src/node-http-handler.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import https from "https";
44
import { afterEach, beforeEach, describe, expect, test as it, vi } from "vitest";
55

66
import { NodeHttpHandler } from "./node-http-handler";
7+
import { timing } from "./timing";
78

89
vi.mock("http", async () => {
910
const actual = (await vi.importActual("http")) as any;
@@ -103,9 +104,10 @@ describe("NodeHttpHandler", () => {
103104
}),
104105
],
105106
])("sets socketAcquisitionWarningTimeout correctly when input is %s", async (_, option) => {
107+
vi.spyOn(timing, "setTimeout");
106108
const nodeHttpHandler = new NodeHttpHandler(option);
107-
const config = await (nodeHttpHandler as any).configProvider;
108-
expect(config.socketAcquisitionWarningTimeout).toEqual(randomSocketAcquisitionWarningTimeout);
109+
await nodeHttpHandler.handle({} as any);
110+
expect(vi.mocked(timing.setTimeout).mock.calls[0][1]).toBe(randomSocketAcquisitionWarningTimeout);
109111
});
110112

111113
it.each([

0 commit comments

Comments
 (0)