From 07cc2a0881fe917d61906bd71051a1f35b03ce7c Mon Sep 17 00:00:00 2001 From: Balazs Bajorics <2226774+balazsbajorics@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:16:42 +0200 Subject: [PATCH] isLocalForageAvailable returns false for tests --- website-next/components/common/server.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website-next/components/common/server.ts b/website-next/components/common/server.ts index 1aad7c5b3d54..c895f099f54c 100644 --- a/website-next/components/common/server.ts +++ b/website-next/components/common/server.ts @@ -1,5 +1,11 @@ import localforage from 'localforage' -import { UTOPIA_BACKEND, THUMBNAIL_ENDPOINT, ASSET_ENDPOINT, BASE_URL } from './env-vars' +import { + UTOPIA_BACKEND, + THUMBNAIL_ENDPOINT, + ASSET_ENDPOINT, + BASE_URL, + IS_TEST_ENVIRONMENT, +} from './env-vars' import type { ProjectListing } from './persistence' import type { LoginState } from './user' import { @@ -88,6 +94,9 @@ export async function getLoginState(useCache: 'cache' | 'no-cache'): Promise { + if (IS_TEST_ENVIRONMENT) { + return false + } if (localForageAvailableResult == null) { const result = await localforage .keys()