• 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
16const intersectionObserverMock = () => ({
17  observe: () => null,
18});
19window.IntersectionObserver = jest.fn().mockImplementation(intersectionObserverMock);
20
21// @ts-ignore
22import { SpChartManager } from '../../../../dist/trace/component/chart/SpChartManager.js';
23// @ts-ignore
24import { SpSystemTrace } from '../../../../dist/trace/component/SpSystemTrace.js';
25
26const sqlite = require('../../../../dist/trace/database/SqlLite.js');
27jest.mock('../../../../dist/trace/database/SqlLite.js');
28
29// @ts-ignore
30window.ResizeObserver = window.ResizeObserver ||
31    jest.fn().mockImplementation(() => ({
32      disconnect: jest.fn(),
33      observe: jest.fn(),
34      unobserve: jest.fn(),
35    }));
36describe('SpChartManager Test', () => {
37  let chartManager = new SpChartManager();
38  let queryDataDICT = sqlite.queryDataDICT;
39  let dataDICT = [
40    {
41      id: 251,
42      data: 'delay',
43    },
44    {
45      id: 251,
46      data: 'caller',
47    },
48  ];
49  queryDataDICT.mockResolvedValue(dataDICT);
50
51  it('SpChartManager01', function () {
52    expect(chartManager).not.toBeUndefined();
53  });
54});
55