Fix screenshare notice window and gracefully fallback mock test env

This commit is contained in:
ayumi-signal 2024-04-17 10:53:54 -07:00 committed by GitHub
parent 154254f471
commit 968d8d8911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { makeEnumParser } from './util/enum';
import * as log from './logging/log';
// Many places rely on this enum being a string.
export enum Environment {
@ -49,7 +50,9 @@ export const isTestEnvironment = (env: Environment): boolean =>
export const isTestOrMockEnvironment = (): boolean => {
if (isMockTestEnvironment == null) {
throw new Error('Mock test environment not set');
log.error('Mock test environment not set');
}
return isTestEnvironment(getEnvironment()) || isMockTestEnvironment;
return (
isTestEnvironment(getEnvironment()) || (isMockTestEnvironment ?? false)
);
};