• 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
16// @ts-ignore
17import {USBHead} from "../../../dist/hdc/message/USBHead.js";
18
19describe('USBHead Test', ()=> {
20    let usbHead = new USBHead();
21    it('USBHeadTest01', function () {
22        expect(usbHead).not.toBeUndefined()
23    });
24
25    it('USBHeadTest02', function () {
26        expect(usbHead.flag).toBeUndefined()
27    });
28
29    it('USBHeadTest03', function () {
30        usbHead.flag = true;
31        expect(usbHead.flag).toBeTruthy()
32    });
33
34    it('USBHeadTest04', function () {
35        expect(usbHead.option).toBeUndefined()
36    });
37
38    it('USBHeadTest05', function () {
39        usbHead.option = true;
40        expect(usbHead.option).toBeTruthy()
41    });
42
43    it('USBHeadTest06', function () {
44        expect(usbHead.sessionId).toBeUndefined()
45    });
46
47    it('USBHeadTest07', function () {
48        usbHead.sessionId = true;
49        expect(usbHead.sessionId).toBeTruthy()
50    });
51
52    it('USBHeadTest08', function () {
53        expect(usbHead.dataSize).toBeFalsy()
54    });
55
56    it('USBHeadTest09', function () {
57        usbHead.dataSize = true;
58        expect(usbHead.dataSize).toBeTruthy()
59    });
60
61    it('USBHeadTest10', function () {
62        expect(usbHead.toString()).not.toBeUndefined()
63    });
64
65    it('USBHeadTest11', function () {
66        usbHead.parseHeadData = jest.fn(()=>undefined)
67        // let data = {
68        //     getUint8:1,
69        //     getUint32:3
70        // }
71        expect(usbHead.parseHeadData()).toBeUndefined()
72    });
73})