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 16const sqlite = require('../../../../dist/trace/database/SqlLite.js'); 17jest.mock('../../../../dist/trace/database/SqlLite.js'); 18 19window.ResizeObserver = 20 window.ResizeObserver || 21 jest.fn().mockImplementation(() => ({ 22 disconnect: jest.fn(), 23 observe: jest.fn(), 24 unobserve: jest.fn(), 25 })); 26 27// @ts-ignore 28import { SpChartManager } from '../../../../dist/trace/component/chart/SpChartManager.js'; 29// @ts-ignore 30import { SpIrqChart } from '../../../../dist/trace/component/chart/SpIrqChart.js'; 31 32describe('SpIrqChart Test', () => { 33 let irqChart = new SpIrqChart(new SpChartManager()); 34 let irqList = sqlite.queryIrqList; 35 let irqListData = [ 36 { 37 name: 'test', 38 cpu: 0, 39 }, 40 ]; 41 irqList.mockResolvedValue(irqListData); 42 43 it('SpIrqChart01', function () { 44 expect(irqChart.init()).toBeDefined(); 45 }); 46 47 it('SpIrqChart02', function () { 48 expect(irqChart.initFolder()).toBeDefined(); 49 }); 50}); 51