summaryrefslogtreecommitdiff
path: root/installed-tests/js/testPackage.js
blob: 624e8521177616728770b0916adc34c6f5d0ee75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2017 Red Hat, Inc.

const Pkg = imports.package;

describe('Package module', function () {
    it('finds an existing library', function () {
        expect(Pkg.checkSymbol('Regress', '1.0')).toEqual(true);
    });

    it('doesn\'t find a non-existent library', function () {
        expect(Pkg.checkSymbol('Rägräss', '1.0')).toEqual(false);
    });

    it('finds a function', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'get_variant')).toEqual(true);
    });

    it('doesn\'t find a non-existent function', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'get_väriänt')).toEqual(false);
    });

    it('finds a class', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj')).toEqual(true);
    });

    it('doesn\'t find a non-existent class', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestNoObj')).toEqual(false);
    });

    it('finds a property', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj.bare')).toEqual(true);
    });

    it('doesn\'t find a non-existent property', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj.bäre')).toEqual(false);
    });

    it('finds a static function', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj.static_method')).toEqual(true);
    });

    it('doesn\'t find a non-existent static function', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj.stätic_methöd')).toEqual(false);
    });

    it('finds a method', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj.null_out')).toEqual(true);
    });

    it('doesn\'t find a non-existent method', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestObj.nüll_out')).toEqual(false);
    });

    it('finds an interface', function () {
        expect(Pkg.checkSymbol('GIMarshallingTests', '1.0', 'Interface')).toEqual(true);
    });

    it('doesn\'t find a non-existent interface', function () {
        expect(Pkg.checkSymbol('GIMarshallingTests', '1.0', 'Interfäce')).toEqual(false);
    });

    it('finds an interface method', function () {
        expect(Pkg.checkSymbol('GIMarshallingTests', '1.0', 'Interface.test_int8_in')).toEqual(true);
    });

    it('doesn\'t find a non-existent interface method', function () {
        expect(Pkg.checkSymbol('GIMarshallingTests', '1.0', 'Interface.test_int42_in')).toEqual(false);
    });

    it('finds an enum value', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestEnum.VALUE1')).toEqual(true);
    });

    it('doesn\'t find a non-existent enum value', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'TestEnum.value1')).toEqual(false);
    });

    it('finds a constant', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'BOOL_CONSTANT')).toEqual(true);
    });

    it('doesn\'t find a non-existent constant', function () {
        expect(Pkg.checkSymbol('Regress', '1.0', 'BööL_CONSTANT')).toEqual(false);
    });
});