/* * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { TabPaneHiLogs } from '../../../../../../src/trace/component/trace/sheet/hilog/TabPaneHiLogs'; import { TraceSheet } from '../../../../../../src/trace/component/trace/base/TraceSheet'; import '../../../../../../src/base-ui/table/LitPageTable' import { TraceRow } from '../../../../../../src/trace/component/trace/base/TraceRow'; import { queryLogAllData } from "../../../../../../src/trace/database/SqlLite"; jest.mock('../../../../../../src/base-ui/table/lit-table', () => { return { recycleDataSource: (): void => { }, }; }); jest.mock('../../../../../../src/js-heap/model/DatabaseStruct', () => { }); const intersectionObserverMock = (): { observe: () => null } => ({ observe: (): null => null, }); window.IntersectionObserver = jest.fn().mockImplementation(intersectionObserverMock); jest.mock('../../../../../../src/trace/component/trace/base/TraceSheet', () => { return {}; }); jest.mock('../../../../../../src/trace/database/ui-worker/ProcedureWorkerCPU', () => { return { cpuCount: 1, CpuRender: Object, EmptyRender: Object, }; }); const sqlit = require('../../../../../../src/trace/database/SqlLite'); jest.mock('../../../../../../src/trace/database/SqlLite'); window.ResizeObserver = window.ResizeObserver || jest.fn().mockImplementation(() => ({ disconnect: jest.fn(), observe: jest.fn(), unobserve: jest.fn(), })); describe('TabPaneHilogs Test', (): void => { TraceRow.range = jest.fn(() => true); TraceRow.range!.startNS = jest.fn(() => 0); TraceRow.range!.endNS = jest.fn(() => 27763331331); TraceRow.range!.totalNS = jest.fn(() => 27763331331); let hiLogsTab = new TabPaneHiLogs(); document.body.innerHTML = '
'; let vessel = document.querySelector