1/*
2* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15const { getProperties, enumParamFunc, NodeSayHello, NodeSayHi, WindowType } = require("./out/build/Release/napitest")
16const test = require("./out/build/Release/napitest")
17var assert = require("assert");
18const { consumers } = require("stream");
19
20describe('test_Interface', function () {
21    function abc(ret) {
22        assert.strictEqual(ret, '');
23    }
24
25    // 测试:function getProperties(callback: AsyncCallback<WindowProperties>): void;
26    it('test getProperties', function () {
27        getProperties().then(abc);
28    });
29});
30
31describe('test_Interface2', function () {
32    let tc = new NodeSayHello()
33    it('test interfaceFunc', function () {
34      /* 测试
35        interface NodeSayHello {
36            interfaceFunc(v0: string, v1: WindowType): boolean;
37        }
38        */
39        let ret = tc.interfaceFunc('hello', 5);
40        assert.strictEqual(ret, false);
41    });
42});
43
44describe('test_Class', function () {
45    let tc1 = new NodeSayHi()
46
47    /* 测试
48    export class NodeSayHi {
49        classFunc(v0: WindowType, v1: number): string;   // Class中的方法参数是枚举
50    }
51    */
52    it('test classFunc', function () {
53        let ret = tc1.classFunc(6, 8);
54        assert.strictEqual(ret, '');
55    });
56});
57
58describe('test_Function', function () {
59    it('test enumParamFunc', function () {
60        // 测试:function enumParamFunc(v0: boolean, v1: WindowType): number;
61        let ret = enumParamFunc(true, WindowType.TYPE_APP);
62        assert.strictEqual(ret, 0);
63    });
64});
65
66
67