fix tests
This commit is contained in:
parent
75845606c4
commit
497e8493fe
@ -30,8 +30,7 @@ const mockOnAuthenticationFailure = vi.fn((handler: () => void) => {
|
|||||||
const defaultConnectImpl = async () => {
|
const defaultConnectImpl = async () => {
|
||||||
// Simulate successful connection by calling the handler after a delay
|
// Simulate successful connection by calling the handler after a delay
|
||||||
if (connectHandler) {
|
if (connectHandler) {
|
||||||
// Use setTimeout to simulate async connection
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
||||||
connectHandler();
|
connectHandler();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -135,7 +134,7 @@ describe("probeTwitch", () => {
|
|||||||
// Simulate connection failure by calling disconnect handler
|
// Simulate connection failure by calling disconnect handler
|
||||||
// onDisconnect signature: (manually: boolean, reason?: Error) => void
|
// onDisconnect signature: (manually: boolean, reason?: Error) => void
|
||||||
if (disconnectHandler) {
|
if (disconnectHandler) {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||||
disconnectHandler(false, new Error("Connection failed"));
|
disconnectHandler(false, new Error("Connection failed"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -162,7 +161,7 @@ describe("probeTwitch", () => {
|
|||||||
// Simulate connection failure by calling disconnect handler
|
// Simulate connection failure by calling disconnect handler
|
||||||
// onDisconnect signature: (manually: boolean, reason?: Error) => void
|
// onDisconnect signature: (manually: boolean, reason?: Error) => void
|
||||||
if (disconnectHandler) {
|
if (disconnectHandler) {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||||
disconnectHandler(false, new Error("Network error"));
|
disconnectHandler(false, new Error("Network error"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -192,7 +191,7 @@ describe("probeTwitch", () => {
|
|||||||
// Simulate connection failure by calling disconnect handler
|
// Simulate connection failure by calling disconnect handler
|
||||||
// onDisconnect signature: (manually: boolean, reason?: Error) => void
|
// onDisconnect signature: (manually: boolean, reason?: Error) => void
|
||||||
if (disconnectHandler) {
|
if (disconnectHandler) {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||||
disconnectHandler(false, "String error" as unknown as Error);
|
disconnectHandler(false, "String error" as unknown as Error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user