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
16jest.mock('../../../../src/trace/component/SpSystemTrace', () => {
17  return {};
18});
19const sqlite = require('../../../../src/trace/database/sql/Irq.sql');
20jest.mock('../../../../src/trace/database/sql/Irq.sql');
21jest.mock('../../../../src/js-heap/model/DatabaseStruct');
22// @ts-ignore
23window.ResizeObserver =
24  window.ResizeObserver ||
25  jest.fn().mockImplementation(() => ({
26    disconnect: jest.fn(),
27    observe: jest.fn(),
28    unobserve: jest.fn(),
29  }));
30
31import { SpArkTsChart } from '../../../../src/trace/component/chart/SpArkTsChart';
32
33jest.mock('../../../../src/trace/database/ui-worker/ProcedureWorker', () => {
34  return {};
35});
36
37describe('SpIrqChart Test', () => {
38  let htmlElement: any = document.createElement('sp-system-trace');
39  let spArkTsChart = new SpArkTsChart(htmlElement);
40  let irqList = sqlite.queryIrqList;
41  let irqListData = [
42    {
43      name: 'test',
44      cpu: 0,
45    },
46  ];
47  irqList.mockResolvedValue(irqListData);
48  it('SpArkTsChart01', function () {
49    expect(spArkTsChart).not.toBe({ initChart: [], loadJsDatabase: {}, trace: undefined });
50  });
51});
52