1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | // *****************************************************************************
|
4 | // Copyright (C) 2021 Red Hat and others.
|
5 | //
|
6 | // This program and the accompanying materials are made available under the
|
7 | // terms of the Eclipse Public License v. 2.0 which is available at
|
8 | // http://www.eclipse.org/legal/epl-2.0.
|
9 | //
|
10 | // This Source Code may also be made available under the following Secondary
|
11 | // Licenses when the conditions for such availability set forth in the Eclipse
|
12 | // Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
13 | // with the GNU Classpath Exception which is available at
|
14 | // https://www.gnu.org/software/classpath/license.html.
|
15 | //
|
16 | // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
17 | // *****************************************************************************
|
18 | const assert = require("assert");
|
19 | const promise_util_1 = require("./promise-util");
|
20 | const event_1 = require("./event");
|
21 | describe('promise-util', () => {
|
22 | it('should time out', async () => {
|
23 | const emitter = new event_1.Emitter();
|
24 | try {
|
25 | await (0, promise_util_1.waitForEvent)(emitter.event, 1000);
|
26 | assert.fail('did not time out');
|
27 | }
|
28 | catch (e) {
|
29 | // OK
|
30 | }
|
31 | });
|
32 | describe('promise-util', () => {
|
33 | it('should get event', async () => {
|
34 | const emitter = new event_1.Emitter();
|
35 | setTimeout(() => {
|
36 | emitter.fire('abcd');
|
37 | }, 500);
|
38 | assert.strictEqual(await (0, promise_util_1.waitForEvent)(emitter.event, 1000), 'abcd');
|
39 | });
|
40 | });
|
41 | });
|
42 | //# sourceMappingURL=promise-util.spec.js.map |
\ | No newline at end of file |