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 16import { TabPaneHiLogSummary } from '../../../../../../src/trace/component/trace/sheet/hilog/TabPaneHiLogSummary'; 17const sqlLite = require('../../../../../../src/trace/database/sql/SqlLite.sql'); 18jest.mock('../../../../../../src/trace/database/sql/SqlLite.sql'); 19 20window.ResizeObserver = 21 window.ResizeObserver || 22 jest.fn().mockImplementation(() => ({ 23 disconnect: jest.fn(), 24 observe: jest.fn(), 25 unobserve: jest.fn(), 26 })); 27 28describe('TabPaneHilogSummary Test', () => { 29 let summaryTab = new TabPaneHiLogSummary(); 30 let queryLogAllData = sqlLite.queryLogAllData; 31 let data = [ 32 { 33 id: 1, 34 domain: "d", 35 processName: "s", 36 level: 1, 37 context: "60", 38 startTs: 5, 39 dur: 511, 40 tag: "5", 41 originTime: 48, 42 } 43 ]; 44 queryLogAllData.mockResolvedValue(data); 45 46 let summaryData = { 47 leftNs: 0, 48 rightNs: 33892044011, 49 hiLogs: [''], 50 sysAlllogsData: [{ 51 id: 2, 52 pid: 1119, 53 tid: 1172, 54 processName: 'process1119', 55 startTs: 33872275426, 56 level: 'I', 57 tag: 'C02d0c/Hiprofiler', 58 context: 'ParseTimeExtend: upd', 59 time: 0, 60 depth: 0, 61 dur: 0, 62 },{ 63 id: 3, 64 pid: 1119, 65 tid: 1172, 66 processName: 'process1119', 67 startTs: 33874375717, 68 level: 'W', 69 tag: 'C02d0c/Hiprofiler', 70 context: 'ParseTimeExtend: upd', 71 time: 0, 72 depth: 0, 73 dur: 0, 74 },{ 75 id: 4, 76 pid: 1119, 77 tid: 1172, 78 processName: 'process1119', 79 startTs: 33878711051, 80 level: 'D', 81 tag: 'C02d0c/Hiprofiler', 82 context: 'ParseTimeExtend: upd', 83 time: 0, 84 depth: 0, 85 dur: 0, 86 },{ 87 id: 5, 88 pid: 1119, 89 tid: 1172, 90 processName: 'process1119', 91 startTs: 33885632885, 92 level: 'E', 93 tag: 'C02d0c/Hiprofiler', 94 context: 'ParseTimeExtend: upd', 95 time: 0, 96 depth: 0, 97 dur: 0, 98 },{ 99 id: 6, 100 pid: 1119, 101 tid: 1172, 102 processName: 'process1119', 103 startTs: 33889724969, 104 level: 'F', 105 tag: 'C02d0c/Hiprofiler', 106 context: 'ParseTimeExtend: upd', 107 time: 0, 108 depth: 0, 109 dur: 0, 110 },{ 111 id: 7, 112 pid: 1119, 113 tid: 1172, 114 processName: 'process1119', 115 startTs: 33892044011, 116 level: 'A', 117 tag: 'C02d0c/Hiprofiler', 118 context: 'ParseTimeExtend: upd', 119 time: 0, 120 depth: 0, 121 dur: 0, 122 }] 123 }; 124 125 it('TabPaneHilogSummaryTest01', function () { 126 summaryTab.data = summaryData; 127 expect(summaryTab.data).toBeUndefined(); 128 }); 129}); 130