Test for window existence on global object

This fixes running tests in Jasmine where window not defined
This commit is contained in:
Lukas Hass 2022-01-24 11:29:26 +01:00
parent 605765a86f
commit 00464f7144
No known key found for this signature in database
GPG Key ID: 7C8CEF72C4039178

View File

@ -5,10 +5,10 @@ declare global {
}
const getEnv = (key: string): string | undefined => {
if (!window.env) {
if (!global.window || !global.window.env) {
return;
}
const value = window.env[key];
const value = global.window.env[key];
if (value === "") {
return;
}