• 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 { TabPaneClockCounter } from '../../../../../../src/trace/component/trace/sheet/clock/TabPaneClockCounter';
17jest.mock('../../../../../../src/trace/database/ui-worker/ProcedureWorker', () => {
18  return {};
19});
20jest.mock('../../../../../../src/trace/database/ui-worker/ProcedureWorkerSnapshot', () => {
21  return {};
22});
23window.ResizeObserver =
24  window.ResizeObserver ||
25  jest.fn().mockImplementation(() => ({
26    disconnect: jest.fn(),
27    observe: jest.fn(),
28    unobserve: jest.fn(),
29  }));
30
31describe('TabPaneClockCounter Test', () => {
32  let map = new Map();
33  map.set('clock', [
34    {
35      filterId: 255,
36      value: 1252,
37      startNS: 4515,
38      dur: 5255,
39      delta: 415,
40    },
41  ]);
42  let clockCounterData = {
43    leftNs: 253,
44    rightNs: 1252,
45    clockMapData: map,
46  };
47  document.body.innerHTML = `<lit-table id="tb-counter"></lit-table>`;
48  let clockCounter = document.querySelector('#tb-counter') as TabPaneClockCounter;
49
50  it('TabPaneClockCounterTest01', function () {
51    clockCounter.data = clockCounterData;
52    expect(clockCounter.data).toEqual(clockCounterData);
53  });
54
55  it('TabPaneClockCounterTest02', function () {
56    let clockCounter = new TabPaneClockCounter();
57    expect(
58      clockCounter.sortByColumn({
59        key: 'number',
60      })
61    ).toBeUndefined();
62  });
63});
64