UNPKG

2.1 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2020 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 progress_location_service_1 = require("./progress-location-service");
20const common_1 = require("../common");
21describe('progress-location-service', () => {
22 const EXP = 'exp';
23 const SCM = 'scm';
24 const FOO = 'foo';
25 it('done event should be fired for multiple progress locations – bug #7311', async () => {
26 const eventLog = new Array();
27 const logEvent = (location, show) => eventLog.push(`${location} show: ${show}`);
28 const service = new progress_location_service_1.ProgressLocationService();
29 [EXP, SCM, FOO].map(location => {
30 service.onProgress(location)(e => logEvent(location, e.show));
31 const progressToken = new common_1.CancellationTokenSource();
32 service.showProgress(`progress-${location}-${Date.now()}`, { text: '', options: { location } }, progressToken.token);
33 return progressToken;
34 }).forEach(t => t.cancel());
35 (0, chai_1.expect)(eventLog.join('\n')).eq(`
36exp show: true
37scm show: true
38foo show: true
39exp show: false
40scm show: false
41foo show: false
42 `.trim());
43 });
44});
45//# sourceMappingURL=progress-location-service.spec.js.map
\No newline at end of file