Increase TS HubConnection timeout in tests for slow build environments (#2328)
This commit is contained in:
parent
b1194f67e7
commit
a699b61ffa
|
|
@ -900,21 +900,16 @@ describe("HubConnection", () => {
|
||||||
const connection = new TestConnection();
|
const connection = new TestConnection();
|
||||||
const hubConnection = createHubConnection(connection);
|
const hubConnection = createHubConnection(connection);
|
||||||
try {
|
try {
|
||||||
hubConnection.serverTimeoutInMilliseconds = 100;
|
hubConnection.serverTimeoutInMilliseconds = 200;
|
||||||
|
|
||||||
const p = new PromiseSource<Error>();
|
const p = new PromiseSource<Error>();
|
||||||
hubConnection.onclose((e) => p.resolve(e));
|
hubConnection.onclose((e) => p.resolve(e));
|
||||||
|
|
||||||
await hubConnection.start();
|
await hubConnection.start();
|
||||||
|
|
||||||
await connection.receive({ type: MessageType.Ping });
|
for (let i = 0; i < 6; i++) {
|
||||||
await delay(50);
|
await pingAndWait(connection);
|
||||||
await connection.receive({ type: MessageType.Ping });
|
}
|
||||||
await delay(50);
|
|
||||||
await connection.receive({ type: MessageType.Ping });
|
|
||||||
await delay(50);
|
|
||||||
await connection.receive({ type: MessageType.Ping });
|
|
||||||
await delay(50);
|
|
||||||
|
|
||||||
connection.stop();
|
connection.stop();
|
||||||
|
|
||||||
|
|
@ -930,7 +925,7 @@ describe("HubConnection", () => {
|
||||||
const connection = new TestConnection();
|
const connection = new TestConnection();
|
||||||
const hubConnection = createHubConnection(connection);
|
const hubConnection = createHubConnection(connection);
|
||||||
try {
|
try {
|
||||||
hubConnection.serverTimeoutInMilliseconds = 100;
|
hubConnection.serverTimeoutInMilliseconds = 200;
|
||||||
|
|
||||||
const p = new PromiseSource<Error>();
|
const p = new PromiseSource<Error>();
|
||||||
hubConnection.onclose((e) => p.resolve(e));
|
hubConnection.onclose((e) => p.resolve(e));
|
||||||
|
|
@ -941,12 +936,9 @@ describe("HubConnection", () => {
|
||||||
|
|
||||||
await hubConnection.start();
|
await hubConnection.start();
|
||||||
|
|
||||||
await connection.receive({ type: MessageType.Ping });
|
for (let i = 0; i < 6; i++) {
|
||||||
await delay(50);
|
await pingAndWait(connection);
|
||||||
await connection.receive({ type: MessageType.Ping });
|
}
|
||||||
await delay(50);
|
|
||||||
await connection.receive({ type: MessageType.Ping });
|
|
||||||
await delay(50);
|
|
||||||
|
|
||||||
connection.stop();
|
connection.stop();
|
||||||
|
|
||||||
|
|
@ -979,6 +971,11 @@ describe("HubConnection", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function pingAndWait(connection: TestConnection): Promise<void> {
|
||||||
|
await connection.receive({ type: MessageType.Ping });
|
||||||
|
await delay(50);
|
||||||
|
}
|
||||||
|
|
||||||
class TestConnection implements IConnection {
|
class TestConnection implements IConnection {
|
||||||
public readonly features: any = {};
|
public readonly features: any = {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue