• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 Huawei Device 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 */
15//@ts-ignore
16import { SpSdkConfig } from "../../../../dist/trace/component/setting/SpSdkConfig.js";
17
18describe('spSdkConfig Test', () => {
19    let spSdkConfig = new SpSdkConfig();
20    it('spSdkConfigTest01', function () {
21        spSdkConfig.show = true;
22        expect(spSdkConfig.show).toBeTruthy();
23    });
24
25    it('spSdkConfigTest02', function () {
26        spSdkConfig.show = false;
27        expect(spSdkConfig.show).toBeFalsy();
28    });
29
30    it('spSdkConfigTest03', function () {
31        spSdkConfig.startSamp = true;
32        expect(spSdkConfig.startSamp).toBeTruthy();
33    });
34
35    it('spSdkConfigTest04', function () {
36        spSdkConfig.startSamp = false;
37        expect(spSdkConfig.startSamp).toBeFalsy();
38    });
39
40    it('spSdkConfigTest05', function () {
41        spSdkConfig.configName = '';
42        expect(spSdkConfig.configName).toBeDefined();
43    });
44
45    it('spSdkConfigTest06', function () {
46        spSdkConfig.configName = 'configName';
47        expect(spSdkConfig.configName).toBeDefined();
48    });
49
50    it('spSdkConfigTest07', function () {
51        spSdkConfig.type = '';
52        expect(spSdkConfig.type).toBeDefined();
53    });
54
55    it('spSdkConfigTest08', function () {
56        spSdkConfig.type = 'configName';
57        expect(spSdkConfig.type).toBeDefined();
58    });
59
60    it('spSdkConfigTest09', function () {
61        expect(spSdkConfig.getPlugName()).not.toBeUndefined();
62    });
63
64    it('spSdkConfigTest10', function () {
65        expect(spSdkConfig.getSampleInterval()).not.toBeUndefined();
66    });
67
68    it('spSdkConfigTest11', function () {
69        expect(spSdkConfig.getGpuConfig()).not.toBeUndefined();
70    });
71
72    it('spSdkConfigTest12', function () {
73        expect(spSdkConfig.checkIntegerInput('')).not.toBeUndefined();
74    });
75
76    it('spSdkConfigTest13', function () {
77        expect(spSdkConfig.checkIntegerInput('checkIntegerInput')).not.toBeUndefined();
78    });
79
80    it('spSdkConfigTest14', function () {
81        expect(spSdkConfig.checkFloatInput('checkFloatInput')).not.toBeUndefined();
82    });
83
84    it('spSdkConfigTest15', function () {
85        expect(spSdkConfig.isAbleShowConfig(false)).toBeUndefined();
86    });
87
88    it('spSdkConfigTest16', function () {
89        expect(spSdkConfig.isAbleShowConfig(true)).toBeUndefined();
90    });
91
92    it('spSdkConfigTest17', function () {
93        expect(spSdkConfig.initConfigList()).toBeUndefined();
94    });
95    it('spSdkConfigTest18', function () {
96        spSdkConfig.configList =
97            {
98                "name": "",
99                "configuration": {
100                    "ss": {
101                        "type": "string",
102                        "default": "strsadsa",
103                        "description": "xxxx",
104                    },
105                    "aa": {
106                        "type": "string",
107                        "default": "11",
108                        "enum": [
109                            "consistent",
110                            "11",
111                            "delegated"
112                        ]
113                    },
114                    "cc": {
115                        "type": "number",
116                        "description": "number1111",
117                    },
118                    "ee": {
119                        "type": "integer",
120                        "default": "12",
121                        "description": "integer1222",
122                    },
123                    "ff": {
124                        "type": "boolean",
125                        "description": "switchhh",
126                    }
127                }
128            };
129        expect(spSdkConfig.initConfig()).toBeUndefined();
130    });
131    it('spSdkConfigTest19', function () {
132        expect(spSdkConfig.getGpuConfig()).toStrictEqual({"aa": "11", "cc": 0, "ee": 12, "ff": true, "ss": "strsadsa",});
133    });
134})