Imported Upstream version 1.12.0
[platform/upstream/gpgme.git] / lang / js / BrowserTestExtension / tests / startup.js
1 /* gpgme.js - Javascript integration for gpgme
2  * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik
3  *
4  * This file is part of GPGME.
5  *
6  * GPGME is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * GPGME is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
18  * SPDX-License-Identifier: LGPL-2.1+
19  *
20  * Author(s):
21  *     Maximilian Krambach <mkrambach@intevation.de>
22  */
23
24 /* global describe, it, expect, Gpgmejs, inputvalues */
25
26 describe('GPGME context', function (){
27     it('Starting a GpgME instance', function (done){
28         let prm = Gpgmejs.init({ timeout: 2000 });
29         const input = inputvalues.someInputParameter;
30         prm.then(
31             function (context){
32                 expect(context).to.be.an('object');
33                 expect(context.encrypt).to.be.a('function');
34                 expect(context.decrypt).to.be.a('function');
35                 expect(context.sign).to.be.a('function');
36                 expect(context.verify).to.be.a('function');
37                 context.Keyring = input;
38                 expect(context.Keyring).to.be.an('object');
39                 expect(context.Keyring).to.not.equal(input);
40                 expect(context.Keyring.getKeys).to.be.a('function');
41                 expect(context.Keyring.getDefaultKey).to.be.a('function');
42                 expect(context.Keyring.importKey).to.be.a('function');
43                 expect(context.Keyring.generateKey).to.be.a('function');
44                 done();
45             });
46     });
47 });