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