UNPKG

2.97 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2022 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 preference_scope_1 = require("./preference-scope");
20describe('PreferenceScope', () => {
21 it('getScopes() should return numbers from broadest to narrowest', () => {
22 (0, chai_1.expect)(preference_scope_1.PreferenceScope.getScopes()).deep.equal([0, 1, 2, 3]);
23 });
24 it('getReversedScopes() should return numbers from narrowest to broadest', () => {
25 (0, chai_1.expect)(preference_scope_1.PreferenceScope.getReversedScopes()).deep.equal([3, 2, 1, 0]);
26 });
27 it('getScopeNames() should return the names of scopes broader than the current one', () => {
28 (0, chai_1.expect)(preference_scope_1.PreferenceScope.getScopeNames(preference_scope_1.PreferenceScope.Workspace)).deep.equal(['Default', 'User', 'Workspace']);
29 });
30 it('is() returns whether a value is a preference scope', () => {
31 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(preference_scope_1.PreferenceScope.Default)).to.be.true;
32 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(preference_scope_1.PreferenceScope.User)).to.be.true;
33 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(preference_scope_1.PreferenceScope.Workspace)).to.be.true;
34 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(preference_scope_1.PreferenceScope.Folder)).to.be.true;
35 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(0)).to.be.true;
36 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(1)).to.be.true;
37 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(2)).to.be.true;
38 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(3)).to.be.true;
39 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(4)).to.be.false;
40 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is(-1)).to.be.false;
41 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is({})).to.be.false;
42 (0, chai_1.expect)(preference_scope_1.PreferenceScope.is('Default')).to.be.false;
43 });
44});
45//# sourceMappingURL=preference-scope.spec.js.map
\No newline at end of file