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 { Top20FrequencyThread } from '../../../../src/trace/component/schedulingAnalysis/Top20FrequencyThread'; 16import '../../../../src/trace/component/schedulingAnalysis/Top20FrequencyThread'; 17// @ts-ignore 18window.ResizeObserver = 19 window.ResizeObserver || 20 jest.fn().mockImplementation(() => ({ 21 disconnect: jest.fn(), 22 observe: jest.fn(), 23 unobserve: jest.fn(), 24 })); 25 26describe('Top20FrequencyThread Test', () => { 27 document.body.innerHTML = `<tabpane-frequency-thread id="thread"></tabpane-frequency-thread>`; 28 let top20FrequencyThread = document.querySelector<Top20FrequencyThread>('#thread'); 29 window.postMessage = jest.fn(() => true); 30 top20FrequencyThread.frequencyThreadTbl = jest.fn(() => true); 31 top20FrequencyThread.frequencyThreadTbl.itemTextHandleMap = new Map(); 32 top20FrequencyThread.frequencyThreadTbl.itemTextHandleMap.set('freq', 1); 33 it('Top20FrequencyThreadTest01', () => { 34 expect(top20FrequencyThread).not.toBeUndefined(); 35 }); 36 it('Top20FrequencyThreadTest02', () => { 37 expect(top20FrequencyThread.sortByColumn).toBeUndefined(); 38 }); 39 it('Top20FrequencyThreadTest03', () => { 40 top20FrequencyThread.queryLogicWorker = jest.fn(); 41 expect(top20FrequencyThread.queryData).toBeUndefined(); 42 }); 43 it('Top20FrequencyThreadTest04', () => { 44 top20FrequencyThread.queryLogicWorker = jest.fn(); 45 expect(top20FrequencyThread.getPieChartData).toBeUndefined(); 46 }); 47 it('Top20FrequencyThreadTest05', () => { 48 top20FrequencyThread.queryLogicWorker = jest.fn(); 49 expect(top20FrequencyThread.queryLogicWorker('', '', {})).toBeUndefined(); 50 }); 51 it('Top20FrequencyThreadTest06', () => { 52 top20FrequencyThread.init = jest.fn(); 53 expect(top20FrequencyThread.init()).toBeUndefined(); 54 }); 55}); 56