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 */ 15import { FormatCommand } from '../../../src/hdc/hdcclient/FormatCommand'; 16import { CmdConstant } from '../../../src/command/CmdConstant'; 17 18describe('FormatCommandTest', () => { 19 it('FormatCommandTest_FormatCommand_01', () => { 20 expect(FormatCommand.string2FormatCommand(CmdConstant.CMD_TRACE_FILE_SIZE)).toEqual({ 21 bJumpDo: true, 22 cmdFlag: -1, 23 parameters: '', 24 }); 25 }); 26 27 it('FormatCommandTest_FormatCommand_02', () => { 28 expect(FormatCommand.string2FormatCommand('shell ps')).toEqual({ 29 bJumpDo: false, 30 cmdFlag: 1001, 31 parameters: 'ps', 32 }); 33 }); 34 35 it('FormatCommandTest_FormatCommand_03', () => { 36 expect(FormatCommand.string2FormatCommand('shell')).toEqual({ 37 bJumpDo: false, 38 cmdFlag: 2000, 39 parameters: '', 40 }); 41 }); 42 43 it('FormatCommandTest_FormatCommand_04', () => { 44 expect(FormatCommand.string2FormatCommand('file recv demo')).toEqual({ 45 bJumpDo: false, 46 cmdFlag: 3000, 47 parameters: 'demo', 48 }); 49 }); 50 51 it('FormatCommandTest_FormatCommand_05', () => { 52 expect(FormatCommand.string2FormatCommand('file send demo')).toEqual({ 53 bJumpDo: false, 54 cmdFlag: 3000, 55 parameters: 'demo', 56 }); 57 }); 58 59 it('FormatCommandTest_FormatCommand_06', () => { 60 expect(FormatCommand.string2FormatCommand(CmdConstant.CMD_GET_HIPERF_EVENTS)).toEqual({ 61 bJumpDo: true, 62 cmdFlag: -1, 63 parameters: '', 64 }); 65 }); 66 67 it('FormatCommandTest_FormatCommand_07', () => { 68 expect(FormatCommand.string2FormatCommand('null')).toEqual({ 69 bJumpDo: true, 70 cmdFlag: -1, 71 parameters: '', 72 }); 73 }); 74}); 75