• 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 {
17  chartXpowerWifiMemoryDataSql,
18  xpowerWifiDataReceiver,
19} from '../../../../../src/trace/database/data-trafic/xpower/XpowerWifiDataReceiver';
20
21describe('xpowerWifiDataReceiver Test', () => {
22  let data = {
23    id: 'd460ac73-bcff-4021-9680-f4672b083e25',
24    name: 162,
25    action: 'exec-proto',
26    params: {
27      startNS: 0,
28      endNS: 40008564984,
29      recordStartNS: 303639498442,
30      recordEndNS: 433748028469,
31      width: 590,
32      trafic: 0,
33    },
34  };
35
36  it('xpowerWifiDataReceiverTest01', () => {
37    const args = {
38      xpowerName: 'WIFIPackets',
39      recordStartNS: 10000,
40      endNS: 30000,
41      startNS: 20000,
42      width: 100,
43    };
44    expect(chartXpowerWifiMemoryDataSql(args)).toBeTruthy();
45  });
46
47  it('xpowerWifiDataReceiverTest02', () => {
48    const args = {
49      xpowerName: 'WIFIBytes',
50      recordStartNS: 10000,
51      endNS: 30000,
52      startNS: 20000,
53      width: 100,
54    };
55    expect(chartXpowerWifiMemoryDataSql(args)).toBeTruthy();
56  });
57
58  it('xpowerWifiDataReceiverTest03', () => {
59    (self as unknown as Worker).postMessage = jest.fn(() => true);
60    expect(
61      xpowerWifiDataReceiver(data, () => {
62        return [5, 9, 1000];
63      })
64    ).toBeUndefined();
65  });
66});
67