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// @ts-ignore 16import {FormatCommand} from "../../../dist/hdc/hdcclient/FormatCommand.js"; 17// @ts-ignore 18import {CmdConstant} from "../../../dist/command/CmdConstant.js"; 19 20describe('FormatCommandTest', () => { 21 it('FormatCommandTest_FormatCommand_01', () => { 22 expect(FormatCommand.string2FormatCommand(CmdConstant.CMD_TRACE_FILE_SIZE)).toEqual({"bJumpDo": true, "cmdFlag": -1, "parameters": ""}) 23 }) 24 25 it('FormatCommandTest_FormatCommand_02', () => { 26 expect(FormatCommand.string2FormatCommand("shell ps")).toEqual({"bJumpDo": false, "cmdFlag": 1001, "parameters": "ps"}) 27 }) 28 29 it('FormatCommandTest_FormatCommand_03', () => { 30 expect(FormatCommand.string2FormatCommand("shell")).toEqual({"bJumpDo": false, "cmdFlag": 2000, "parameters": ""}) 31 }) 32 33 it('FormatCommandTest_FormatCommand_04', () => { 34 expect(FormatCommand.string2FormatCommand("file recv demo")).toEqual({"bJumpDo": false, "cmdFlag":3000, "parameters": "demo"}) 35 }) 36 37 it('FormatCommandTest_FormatCommand_05', () => { 38 expect(FormatCommand.string2FormatCommand("file send demo")).toEqual({"bJumpDo": false, "cmdFlag": 3000, "parameters": "demo"}) 39 }) 40 41 it('FormatCommandTest_FormatCommand_06', () => { 42 expect(FormatCommand.string2FormatCommand(CmdConstant.CMD_GET_HIPERF_EVENTS)).toEqual({"bJumpDo": true, "cmdFlag": -1, "parameters": ""}) 43 }) 44 45 it('FormatCommandTest_FormatCommand_07', () => { 46 expect(FormatCommand.string2FormatCommand("null")).toEqual({"bJumpDo": true, "cmdFlag": -1, "parameters": ""}) 47 }) 48});