From 9b4f5baaeb951ca791885cd2f22a533a817a86dd Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 21 May 2024 11:01:36 +0200 Subject: [PATCH] fix weird error message in unit tests --- frontend/src/common/config.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/common/config.ts b/frontend/src/common/config.ts index d341a150..3905dd5c 100644 --- a/frontend/src/common/config.ts +++ b/frontend/src/common/config.ts @@ -1,6 +1,11 @@ import AxiosStatic from 'axios'; -const url = (typeof document !== 'undefined') ? new URL(document.baseURI) : new URL('http://localhost/'); // workaround for testing in Node environment +let url: URL; +if (typeof document === 'undefined' || document.baseURI === 'about:blank') { + url = new URL('http://localhost/'); // workaround for testing in Node environment +} else { + url = new URL(document.baseURI); +} // these URLs must end on '/': export const baseURL = url.pathname;