• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 '../../../../src/trace/component/chart/SpSegmentationChart';
17import { SpSegmentationChart } from '../../../../src/trace/component/chart/SpSegmentationChart';
18import { SpSystemTrace } from '../../../../src/trace/component/SpSystemTrace';
19
20jest.mock('../../../../src/trace/database/ui-worker/ProcedureWorkerSnapshot', () => {
21  return {};
22});
23jest.mock('../../../../src/trace/database/ui-worker/ProcedureWorker', () => {
24  return {};
25});
26jest.mock('../../../../src/js-heap/model/DatabaseStruct', () => {});
27
28const funcSqlit = require('../../../../src/trace/database/sql/Func.sql');
29jest.mock('../../../../src/trace/database/sql/Func.sql');
30
31const intersectionObserverMock = () => ({
32  observe: () => null,
33});
34window.IntersectionObserver = jest.fn().mockImplementation(intersectionObserverMock);
35// @ts-ignore
36window.ResizeObserver = window.ResizeObserver ||
37  jest.fn().mockImplementation(() => ({
38    disconnect: jest.fn(),
39    observe: jest.fn(),
40    unobserve: jest.fn(),
41  }));
42describe('SpSegmentationChart Test', () => {
43  global.Worker = jest.fn();
44  let mockqueryAllFuncNames = funcSqlit.queryAllFuncNames;
45  mockqueryAllFuncNames.mockResolvedValue([]);
46  let spSystemTrace = new SpSystemTrace();
47  let segmentationChart = new SpSegmentationChart(spSystemTrace);
48  it('SpSegmentationChartTest01 ', function () {
49    segmentationChart.init();
50  });
51});
52