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 spSdkConfig.sdkConfigList = { 94 name: '', 95 configuration: { 96 ss: { 97 type: 'string', 98 default: 'strsadsa', 99 description: 'xxxx', 100 }, 101 aa: { 102 type: 'string', 103 default: '11', 104 enum: ['consistent', '11', 'delegated'], 105 }, 106 cc: { 107 type: 'number', 108 description: 'number1111', 109 }, 110 ee: { 111 type: 'integer', 112 default: '12', 113 description: 'integer1222', 114 }, 115 ff: { 116 type: 'boolean', 117 description: 'switchhh', 118 }, 119 }, 120 }; 121 expect(spSdkConfig.initConfig()).toBeUndefined(); 122 }); 123 it('spSdkConfigTest18', function () { 124 expect(spSdkConfig.getGpuConfig()).toStrictEqual({ 125 aa: '11', 126 cc: 0, 127 ee: 12, 128 ff: false, 129 ss: 'strsadsa', 130 }); 131 }); 132}); 133