From 2e307b2bb970ebb42c892016113626fbb61e45e5 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 14 Feb 2023 01:05:14 -0800 Subject: [PATCH] chore: re add timeout for subscription test --- libs/environment/src/hooks/use-environment.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/environment/src/hooks/use-environment.ts b/libs/environment/src/hooks/use-environment.ts index c78342499..8a56e0cfd 100644 --- a/libs/environment/src/hooks/use-environment.ts +++ b/libs/environment/src/hooks/use-environment.ts @@ -30,6 +30,7 @@ export type Env = Environment & EnvState; export type EnvStore = Env & Actions; const STORAGE_KEY = 'vega_url'; +const SUBSCRIPTION_TIMEOUT = 3000; export const useEnvironment = create((set, get) => ({ ...compileEnvVars(), @@ -186,7 +187,6 @@ const testQuery = async (client: Client) => { } }; -// TODO: fail test if timeout passes const testSubscription = (client: Client) => { return new Promise((resolve) => { const sub = client @@ -204,6 +204,11 @@ const testSubscription = (client: Client) => { sub.unsubscribe(); }, }); + + setTimeout(() => { + resolve(false); + sub.unsubscribe(); + }, SUBSCRIPTION_TIMEOUT); }); };