UNPKG

1.95 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2018 TypeFox and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18const chai_1 = require("chai");
19const mock_logger_1 = require("./test/mock-logger");
20const logger_1 = require("./logger");
21describe('logger', () => {
22 it('window is not defined', () => {
23 (0, chai_1.expect)(() => { window; }).to.throw(ReferenceError, /window is not defined/);
24 });
25 it('window is not defined when converting to boolean', () => {
26 (0, chai_1.expect)(() => { !!window; }).to.throw(ReferenceError, /window is not defined/);
27 });
28 it('window is not defined safe', () => {
29 (0, chai_1.expect)(() => { typeof window !== 'undefined'; }).to.not.throw(ReferenceError);
30 });
31 it('setting the root logger should not throw an error when the window is not defined', () => {
32 (0, chai_1.expect)(() => {
33 try {
34 (0, logger_1.setRootLogger)(new mock_logger_1.MockLogger());
35 }
36 finally {
37 (0, logger_1.unsetRootLogger)();
38 }
39 }).to.not.throw(ReferenceError);
40 });
41});
42//# sourceMappingURL=logger.spec.js.map
\No newline at end of file