Increase TS HubConnection timeout in tests for slow build environments (#2328)

This commit is contained in:
James Newton-King 2018-05-22 09:24:33 +12:00 committed by GitHub
parent b1194f67e7
commit a699b61ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 16 deletions

View File

@ -900,21 +900,16 @@ describe("HubConnection", () => {
const connection = new TestConnection();
const hubConnection = createHubConnection(connection);
try {
hubConnection.serverTimeoutInMilliseconds = 100;
hubConnection.serverTimeoutInMilliseconds = 200;
const p = new PromiseSource<Error>();
hubConnection.onclose((e) => p.resolve(e));
await hubConnection.start();
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);
await connection.receive({ type: MessageType.Ping });
await delay(50);
for (let i = 0; i < 6; i++) {
await pingAndWait(connection);
}
connection.stop();
@ -930,7 +925,7 @@ describe("HubConnection", () => {
const connection = new TestConnection();
const hubConnection = createHubConnection(connection);
try {
hubConnection.serverTimeoutInMilliseconds = 100;
hubConnection.serverTimeoutInMilliseconds = 200;
const p = new PromiseSource<Error>();
hubConnection.onclose((e) => p.resolve(e));
@ -941,12 +936,9 @@ describe("HubConnection", () => {
await hubConnection.start();
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);
for (let i = 0; i < 6; i++) {
await pingAndWait(connection);
}
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 {
public readonly features: any = {};