未验证 提交 95129dc9 编写于 作者: O openharmony_ci 提交者: Gitee

!6610 radiostatistic测试套整改

Merge pull request !6610 from zhangfuzhi/monthly_20221018
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test' import testsuite from '../test/List.test';
export default { export default {
onCreate() { onCreate() {
......
// @ts-nocheck
/** /**
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,48 +12,33 @@ ...@@ -13,48 +12,33 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' import { describe, expect, it } from '@ohos/hypium';
import call from '@ohos.telephony.call'; import call from '@ohos.telephony.call';
import utils from './Utils.ets'
export const PHONE_NUMBER = ''; export function toString(data) {
export const DEFAULT_SLOT_ID = 0;
export const MEDIA_TYPE_VOICE = 0;
export const DIAL_SCENCE_CALL_NORMAL = 0;
export const DIAL_CARRIER_TYPE = 0;
export const DIAL_SCENCE_CALL_PRIVILEGED = 1;
export const BOUNDARY_NUMBER_INT = 2147483649;
export const CALL_ID_NOT_EXIST = 999;
export function toString (data) {
if (typeof data === 'object') { if (typeof data === 'object') {
return JSON.stringify(data); return JSON.stringify(data);
} else { } else {
return data; return data;
} }
} }
;
class CallAttributeOptions { export default function callJsunit() {
constructor (callId) { describe('callTest', function () {
this.callId = callId;
}
}
export default function callJsunit(){
describe('callTest', function(){
console.log("==========> call Test start ==========>"); console.log("==========> call Test start ==========>");
/** /**
* @tc.number Telephony_Call_HasVoiceCapability_HasVoiceCapability * @tc.number Telephony_Call_HasVoiceCapability_HasVoiceCapability
* @tc.name Checks whether a device supports voice calls. * @tc.name Checks whether a device supports voice calls.
* @tc.desc Return type test * @tc.desc Return type test
*/ */
it("Telephony_Call_HasVoiceCapability_HasVoiceCapability",0,async function(done){ it("Telephony_Call_HasVoiceCapability_HasVoiceCapability", 0, async function (done) {
let caseName = 'Telephony_Call_HasVoiceCapability_HasVoiceCapability'; let caseName = 'Telephony_Call_HasVoiceCapability_HasVoiceCapability';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let ret = false; let ret = false;
let voiceCapablity = call.hasVoiceCapability(); let voiceCapablity = call.hasVoiceCapability();
if(voiceCapablity === true || voiceCapablity === false){ if (voiceCapablity === true || voiceCapablity === false) {
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
...@@ -62,440 +46,168 @@ export default function callJsunit(){ ...@@ -62,440 +46,168 @@ export default function callJsunit(){
done(); done();
}); });
/**
* @tc.number Telephony_Call_AudioDevice_DEVICE_MIC
* @tc.name Enum AudioDevice
* @tc.desc Enum value test
*/
it("Telephony_Call_AudioDevice_DEVICE_MIC",0,async function(done){
let caseName = 'Telephony_Call_AudioDevice_DEVICE_MIC';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(call.AudioDevice.DEVICE_MIC);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_CallTransferType_TRANSFER_TYPE_BUSY
* @tc.name Enum CallTransferType
* @tc.desc Enum value test
*/
it("Telephony_Call_CallTransferType_TRANSFER_TYPE_BUSY",0,async function(done){
let caseName = 'Telephony_Call_CallTransferType_TRANSFER_TYPE_BUSY';
console.log(`==========> ${caseName} Test start ==========>`);
expect(1).assertEqual(call.CallTransferType.TRANSFER_TYPE_BUSY);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_CallTransferSettingType_CALL_TRANSFER_REGISTRATION
* @tc.name Enum CallTransferSettingType
* @tc.desc Enum value test
*/
it("Telephony_Call_CallTransferSettingType_CALL_TRANSFER_REGISTRATION",0,async function(done){
let caseName = 'Telephony_Call_CallTransferSettingType_CALL_TRANSFER_REGISTRATION';
console.log(`==========> ${caseName} Test start ==========>`);
expect(3).assertEqual(call.CallTransferSettingType.CALL_TRANSFER_REGISTRATION);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_CallTransferSettingType_CALL_TRANSFER_ERASURE
* @tc.name Enum CallTransferSettingType
* @tc.desc Enum value test
*/
it("Telephony_Call_CallTransferSettingType_CALL_TRANSFER_ERASURE",0, function(done){
let caseName = 'Telephony_Call_CallTransferSettingType_CALL_TRANSFER_ERASURE';
console.log(`==========> ${caseName} Test start ==========>`);
expect(4).assertEqual(call.CallTransferSettingType.CALL_TRANSFER_ERASURE);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_CallAbilityEventId_EVENT_DIAL_NO_CARRIER
* @tc.name Enum CallAbilityEventId
* @tc.desc Enum value test
*/
it("Telephony_Call_CallAbilityEventId_EVENT_DIAL_NO_CARRIER",0, function(done){
let caseName = 'Telephony_Call_CallAbilityEventId_EVENT_DIAL_NO_CARRIER';
console.log(`==========> ${caseName} Test start ==========>`);
expect(1).assertEqual(call.CallAbilityEventId.EVENT_DIAL_NO_CARRIER);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_CallAbilityEventId_EVENT_INVALID_FDN_NUMBER
* @tc.name Enum CallAbilityEventId
* @tc.desc Enum value test
*/
it("Telephony_Call_CallAbilityEventId_EVENT_INVALID_FDN_NUMBER",0, function(done){
let caseName = 'Telephony_Call_CallAbilityEventId_EVENT_INVALID_FDN_NUMBER';
console.log(`==========> ${caseName} Test start ==========>`);
expect(2).assertEqual(call.CallAbilityEventId.EVENT_INVALID_FDN_NUMBER);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/** /**
* @tc.number Telephony_Call_CallTransferInfo_Type * @tc.number Telephony_Call_CallTransferInfo_Type
* @tc.name Interface CallTransferInfo * @tc.name Interface CallTransferInfo
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallTransferInfo_Type', 0, function (done) { it('Telephony_Call_CallTransferInfo_Type', 0, function (done) {
let caseName = 'Telephony_Call_CallTransferInfo_Type'; let caseName = 'Telephony_Call_CallTransferInfo_Type';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callTransferInfo = {transferNum:'10000000001', type: 2, settingType: 1} let callTransferInfo = {
transferNum: '10000000001', type: 2, settingType: 1
};
expect(callTransferInfo.type === 2).assertTrue(); expect(callTransferInfo.type === 2).assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_CallTransferResult_Status * @tc.number Telephony_Call_CallTransferResult_Status
* @tc.name Interface CallTransferResult * @tc.name Interface CallTransferResult
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallTransferResult_Status', 0, function (done) { it('Telephony_Call_CallTransferResult_Status', 0, function (done) {
let caseName = 'Telephony_Call_CallTransferResult_Status'; let caseName = 'Telephony_Call_CallTransferResult_Status';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callTransferResult = {status:0, number: '10000000001'} let callTransferResult = {
status: 0, number: '10000000001'
};
expect(callTransferResult.status === 0).assertTrue(); expect(callTransferResult.status === 0).assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_CallTransferResult_Number * @tc.number Telephony_Call_CallTransferResult_Number
* @tc.name Interface CallTransferResult * @tc.name Interface CallTransferResult
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallTransferResult_Number', 0, function (done) { it('Telephony_Call_CallTransferResult_Number', 0, function (done) {
let caseName = 'Telephony_Call_CallTransferResult_Number'; let caseName = 'Telephony_Call_CallTransferResult_Number';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callTransferResult = {status:0, number: '10000000001'} let callTransferResult = {
status: 0, number: '10000000001'
};
expect(callTransferResult.number === '10000000001').assertTrue(); expect(callTransferResult.number === '10000000001').assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_CallAttributeOptions_CallId * @tc.number Telephony_Call_CallAttributeOptions_CallId
* @tc.name Interface CallAttributeOptions * @tc.name Interface CallAttributeOptions
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallAttributeOptions_CallId', 0, function (done) { it('Telephony_Call_CallAttributeOptions_CallId', 0, function (done) {
let caseName = 'Telephony_Call_CallAttributeOptions_CallId'; let caseName = 'Telephony_Call_CallAttributeOptions_CallId';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callAttributeOptions = {callId:1}; let callAttributeOptions = {
callId: 1
};
expect(callAttributeOptions.callId === 1).assertTrue(); expect(callAttributeOptions.callId === 1).assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_CallRestrictionInfo_Type * @tc.number Telephony_Call_CallRestrictionInfo_Type
* @tc.name Interface CallRestrictionInfo * @tc.name Interface CallRestrictionInfo
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallRestrictionInfo_Type', 0, function (done) { it('Telephony_Call_CallRestrictionInfo_Type', 0, function (done) {
let caseName = 'Telephony_Call_CallRestrictionInfo_Type'; let caseName = 'Telephony_Call_CallRestrictionInfo_Type';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callRestrictionInfo = {type:0, password: '123456', mode:1} let callRestrictionInfo = {
type: 0, password: '123456', mode: 1
};
expect(callRestrictionInfo.type === 0).assertTrue(); expect(callRestrictionInfo.type === 0).assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_CallRestrictionInfo_Mode * @tc.number Telephony_Call_CallRestrictionInfo_Mode
* @tc.name Interface CallRestrictionInfo * @tc.name Interface CallRestrictionInfo
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallRestrictionInfo_Mode', 0, function (done) { it('Telephony_Call_CallRestrictionInfo_Mode', 0, function (done) {
let caseName = 'Telephony_Call_CallRestrictionInfo_Mode'; let caseName = 'Telephony_Call_CallRestrictionInfo_Mode';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callRestrictionInfo = {type:0, password: '123456', mode:1} let callRestrictionInfo = {
type: 0, password: '123456', mode: 1
};
expect(callRestrictionInfo.mode === 1).assertTrue(); expect(callRestrictionInfo.mode === 1).assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_CallEventOptions_EventId * @tc.number Telephony_Call_CallEventOptions_EventId
* @tc.name Interface CallEventOptions * @tc.name Interface CallEventOptions
* @tc.desc Interface value test * @tc.desc Interface value test
*/ */
it('Telephony_Call_CallEventOptions_EventId', 0, function (done) { it('Telephony_Call_CallEventOptions_EventId', 0, function (done) {
let caseName = 'Telephony_Call_CallEventOptions_EventId'; let caseName = 'Telephony_Call_CallEventOptions_EventId';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let callEventOptions = {eventId:1} let callEventOptions = {
eventId: 1
};
expect(callEventOptions.eventId === 1).assertTrue(); expect(callEventOptions.eventId === 1).assertTrue();
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
/** /**
* @tc.number Telephony_Call_DisconnectedDetails_NO_ROUTE_TO_DESTINATION * @tc.number Telephony_Call_Call_MakeCall_0100
* @tc.name Enum DisconnectedDetails * @tc.name Make a call.
* @tc.desc Enum value test * @tc.desc Function test
*/ */
it("Telephony_Call_DisconnectedDetails_UNASSIGNED_NUMBER",0,async function(done){ it("Telephony_Call_Call_MakeCall_0100", 0, async function (done) {
let caseName = 'Telephony_Call_DisconnectedDetails_UNASSIGNED_NUMBER'; let caseName: string = "Telephony_Call_Call_MakeCall_0100";
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(1).assertEqual(call.DisconnectedDetails.UNASSIGNED_NUMBER);
expect(3).assertEqual(call.DisconnectedDetails.NO_ROUTE_TO_DESTINATION);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_CHANNEL_UNACCEPTABLE
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_CHANNEL_UNACCEPTABLE",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_CHANNEL_UNACCEPTABLE';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(6).assertEqual(call.DisconnectedDetails.CHANNEL_UNACCEPTABLE);
expect(8).assertEqual(call.DisconnectedDetails.OPERATOR_DETERMINED_BARRING);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_NORMAL_CALL_CLEARING
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_NORMAL_CALL_CLEARING",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_NORMAL_CALL_CLEARING';
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) { try {
expect(true).assertTrue();
done();
return;
}
expect(16).assertEqual(call.DisconnectedDetails.NORMAL_CALL_CLEARING);
expect(17).assertEqual(call.DisconnectedDetails.USER_BUSY);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_NO_USER_RESPONDING
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_NO_USER_RESPONDING",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_NO_USER_RESPONDING';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(18).assertEqual(call.DisconnectedDetails.NO_USER_RESPONDING);
expect(19).assertEqual(call.DisconnectedDetails.USER_ALERTING_NO_ANSWER);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_CALL_REJECTED
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_CALL_REJECTED",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_CALL_REJECTED';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(21).assertEqual(call.DisconnectedDetails.CALL_REJECTED);
expect(22).assertEqual(call.DisconnectedDetails.NUMBER_CHANGED);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_DESTINATION_OUT_OF_ORDER
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_DESTINATION_OUT_OF_ORDER",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_DESTINATION_OUT_OF_ORDER';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(27).assertEqual(call.DisconnectedDetails.DESTINATION_OUT_OF_ORDER);
expect(28).assertEqual(call.DisconnectedDetails.INVALID_NUMBER_FORMAT);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_DESTINATION_NETWORK_OUT_OF_ORDER
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_DESTINATION_NETWORK_OUT_OF_ORDER",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_NETWORK_OUT_OF_ORDER';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(38).assertEqual(call.DisconnectedDetails.NETWORK_OUT_OF_ORDER);
expect(41).assertEqual(call.DisconnectedDetails.TEMPORARY_FAILURE);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_INVALID_PARAMETER
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_INVALID_PARAMETER",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_INVALID_PARAMETER';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(1025).assertEqual(call.DisconnectedDetails.INVALID_PARAMETER);
expect(1026).assertEqual(call.DisconnectedDetails.SIM_NOT_EXIT);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_SIM_PIN_NEED
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_SIM_PIN_NEED",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_SIM_PIN_NEED';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(1027).assertEqual(call.DisconnectedDetails.SIM_PIN_NEED);
expect(1029).assertEqual(call.DisconnectedDetails.CALL_NOT_ALLOW);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_DisconnectedDetails_SIM_INVALID
* @tc.name Enum DisconnectedDetails
* @tc.desc Enum value test
*/
it("Telephony_Call_DisconnectedDetails_SIM_INVALID",0,async function(done){
let caseName = 'Telephony_Call_DisconnectedDetails_SIM_INVALID';
console.log(`==========> ${caseName} Test start ==========>`);
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(1045).assertEqual(call.DisconnectedDetails.SIM_INVALID);
expect(1045).assertEqual(call.DisconnectedDetails.SIM_INVALID);
console.log(`==========> ${caseName} Test end ==========>`);
done();
});
/**
* @tc.number Telephony_Call_Call_MakeCall_0100
* @tc.name Make a call.
* @tc.desc Function test
*/
it("Telephony_Call_Call_MakeCall_0100",0,async function(done){
let caseName:string = "Telephony_Call_Call_MakeCall_0100";
console.log(`==========> ${caseName} Test start ==========>`);
try{
let telNumber = ""; let telNumber = "";
call.makeCall(telNumber,(error) => { call.makeCall(telNumber, (error) => {
if(error){ if (error) {
console.log(`${caseName} fail,case success,error:${toString(error)}`); console.log("makeCall callback: err->" + JSON.stringify(error));
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
return; return;
} }
expect().assertFail();
console.log(`${caseName} success,case fail`);
done(); done();
}); });
}catch(err){ } catch (err) {
console.log(`${caseName} fail,case success,error:${toString(err)}`); console.log("makeCall callback: err->" + JSON.stringify(err));
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
return;
} }
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done();
}); });
/** /**
* @tc.number Telephony_Call_Call_MakeCall_0200 * @tc.number Telephony_Call_Call_MakeCall_0200
* @tc.name Makes a call. * @tc.name Makes a call.
* @tc.desc Function test * @tc.desc Function test
*/ */
it("Telephony_Call_Call_MakeCall_0200",0,async function(done){ it("Telephony_Call_Call_MakeCall_0200", 0, async function (done) {
let caseName:string = "Telephony_Call_Call_MakeCall_0200"; let caseName: string = "Telephony_Call_Call_MakeCall_0200";
console.log(`==========> ${caseName} Test start ==========>`); console.log(`==========> ${caseName} Test start ==========>`);
let telNumber = ""; let telNumber = "";
try{ try {
call.makeCall(telNumber).then(()=>{ call.makeCall(telNumber).then(() => {
console.log(`${caseName} success,case fail`);
done(); done();
}).catch(error =>{ }).catch(error => {
console.log(`${caseName} fail,case success,error:${toString(error)}`); console.log("makeCall callback: err->" + JSON.stringify(error));
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
return;
}); });
}catch(err){ } catch (err) {
console.log(`${caseName} fail,case success,error:${toString(err)}`); console.log("makeCall callback: err->" + JSON.stringify(err));
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
return;
} }
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done();
}); });
}); });
}
} \ No newline at end of file
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,10 +13,11 @@ ...@@ -14,10 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index' import { describe, expect, it } from '@ohos/hypium';
import convertxml from '@ohos.convertxml' import convertxml from '@ohos.convertxml';
export default function convertOptionsJsunit() { export default function convertOptionsJsunit() {
describe('XmlTest_radio_1',function () { describe('XmlTest_radio_1', function () {
console.log("************* settings Test start*************"); console.log("************* settings Test start*************");
it('Telephony_convertxml_ConvertXML_0100', 0, async function (done) { it('Telephony_convertxml_ConvertXML_0100', 0, async function (done) {
var xml = var xml =
...@@ -28,30 +28,45 @@ export default function convertOptionsJsunit() { ...@@ -28,30 +28,45 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false,trim :true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: true,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_0200', 0, async function (done) { it('Telephony_convertxml_ConvertXML_0200', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -60,28 +75,44 @@ export default function convertOptionsJsunit() { ...@@ -60,28 +75,44 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true})); let options = {
var str1 = '{"_elements":[{"_type":"element",'+ trim: false,
'"_name":"note",'+ declarationKey: "_declaration",
'"_attributes":{"importance":"high",'+ instructionKey: "_instruction",
'"logged":"true"},'+ attributesKey: "_attributes",
'"_elements":[{"_type":"element",'+ textKey: "_text",
'"_name":"title",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"text",'+ doctypeKey: "_doctype",
'"_text":"Happy"}]},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Work"}]},'+ elementsKey: "_elements",
'{"_type":"element",'+ ignoreDeclaration: true
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Play"}]}]}]}' var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_0300', 0,async function (done) { it('Telephony_convertxml_ConvertXML_0300', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -90,24 +121,40 @@ export default function convertOptionsJsunit() { ...@@ -90,24 +121,40 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true})); let options = {
var str1 = '{"_elements":[{"_type":"element",'+ trim: false,
'"_name":"note",'+ declarationKey: "_declaration",
'"_attributes":{"importance":"high",'+ instructionKey: "_instruction",
'"logged":"true"},'+ attributesKey: "_attributes",
'"_elements":[{"_type":"element",'+ textKey: "_text",
'"_name":"title",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"text",'+ doctypeKey: "_doctype",
'"_text":"Happy"}]},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Work"}]},'+ elementsKey: "_elements",
'{"_type":"element",'+ ignoreDeclaration: true
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Play"}]}]}]}' var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -120,57 +167,89 @@ export default function convertOptionsJsunit() { ...@@ -120,57 +167,89 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreAttributes: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_elements":[{"_type":"element",'+ textKey: "_text",
'"_name":"title",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"text",'+ doctypeKey: "_doctype",
'"_text":"Happy"}]},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Work"}]},'+ elementsKey: "_elements",
'{"_type":"element",'+ ignoreAttributes: true
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Play"}]}]}]}' var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_0500', 0,async function (done) { it('Telephony_convertxml_ConvertXML_0500', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <!--note-->'+ ' <!--note-->' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreComment: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements",
'"_elements":[{"_type":"text",'+ ignoreComment: true
'"_text":"Work"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -178,65 +257,97 @@ export default function convertOptionsJsunit() { ...@@ -178,65 +257,97 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <![CDATA[<foo></bar>]]>'+ ' <![CDATA[<foo></bar>]]>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreCDATA: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements",
'"_elements":[{"_type":"text",'+ ignoreCDATA: true
'"_text":"Work"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_0700', 0, async function (done) { it('Telephony_convertxml_ConvertXML_0700', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>'+ '<!DOCTYPE foo>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDoctype: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements",
'"_elements":[{"_type":"text",'+ ignoreDoctype: true
'"_text":"Work"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -249,20 +360,36 @@ export default function convertOptionsJsunit() { ...@@ -249,20 +360,36 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreText: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title"},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo"},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo"}]}]}' elementsKey: "_elements",
ignoreText: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title"},' +
'{"_type":"element",' +
'"_name":"todo"},' +
'{"_type":"element",' +
'"_name":"todo"}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -275,26 +402,41 @@ export default function convertOptionsJsunit() { ...@@ -275,26 +402,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, declarationKey: "123"})); let options = {
var str1 = '{"123":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "123",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"123":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -302,35 +444,50 @@ export default function convertOptionsJsunit() { ...@@ -302,35 +444,50 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <?go there?>'+ ' <?go there?>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, instructionKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "123",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"123":"there",'+ doctypeKey: "_doctype",
'"_type":"instruction",'+ commentKey: "_comment",
'"_name":"go"},'+ parentKey: "_parent",
'{"_type":"element",'+ typeKey: "_type",
'"_name":"title",'+ nameKey: "_name",
'"_elements":[{"_type":"text",'+ elementsKey: "_elements"
'"_text":"Happy"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Work"}]},'+ '"_elements":[{"_type":"element",' +
'{"_type":"element",'+ '"_name":"note",' +
'"_name":"todo",'+ '"_attributes":{"importance":"high",' +
'"_elements":[{"_type":"text",'+ '"logged":"true"},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"123":"there",' +
'"_type":"instruction",' +
'"_name":"go"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -338,35 +495,50 @@ export default function convertOptionsJsunit() { ...@@ -338,35 +495,50 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <?go there?>'+ ' <?go there?>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, attributesKey: "123"})); let options = {
var str1 = '{"_declaration":{"123":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"123":{"importance":"high",'+ instructionKey: "_instruction",
'"logged":"true"},'+ attributesKey: "123",
'"_type":"element",'+ textKey: "_text",
'"_name":"note",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"instruction",'+ doctypeKey: "_doctype",
'"_name":"go",'+ commentKey: "_comment",
'"_instruction":"there"},'+ parentKey: "_parent",
'{"_type":"element",'+ typeKey: "_type",
'"_name":"title",'+ nameKey: "_name",
'"_elements":[{"_type":"text",'+ elementsKey: "_elements"
'"_text":"Happy"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"123":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Work"}]},'+ '"_elements":[{"123":{"importance":"high",' +
'{"_type":"element",'+ '"logged":"true"},' +
'"_name":"todo",'+ '"_type":"element",' +
'"_elements":[{"_type":"text",'+ '"_name":"note",' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"instruction",' +
'"_name":"go",' +
'"_instruction":"there"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -379,26 +551,41 @@ export default function convertOptionsJsunit() { ...@@ -379,26 +551,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, textKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "123",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"123":"Happy",'+ parentKey: "_parent",
'"_type":"text"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"123":"Work",'+ };
'"_type":"text"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"123":"Play",'+ '"_elements":[{"_type":"element",' +
'"_type":"text"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"123":"Happy",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"Work",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"Play",' +
'"_type":"text"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -406,102 +593,146 @@ export default function convertOptionsJsunit() { ...@@ -406,102 +593,146 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <![CDATA[1 is < 2]]>'+ ' <![CDATA[1 is < 2]]>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, cdataKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "123",
'"_elements":[{"123":"1 is < 2",'+ doctypeKey: "_doctype",
'"_type":"cdata"},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"title",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Happy"}]},'+ elementsKey: "_elements"
'{"_type":"element",'+ };
'"_name":"todo",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_elements":[{"_type":"text",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_text":"Work"}]},'+ '"encoding":"utf-8"}},' +
'{"_type":"element",'+ '"_elements":[{"_type":"element",' +
'"_name":"todo",'+ '"_name":"note",' +
'"_elements":[{"_type":"text",'+ '"_attributes":{"importance":"high",' +
'"_text":"Play"}]}]}]}' '"logged":"true"},' +
'"_elements":[{"123":"1 is < 2",' +
'"_type":"cdata"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_1400', 0, async function (done) { it('Telephony_convertxml_ConvertXML_1400', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>'+ '<!DOCTYPE foo>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, doctypeKey: 'doctype'})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"doctype","doctype":"foo"},'+ instructionKey: "_instruction",
'{"_type":"element",'+ attributesKey: "_attributes",
'"_name":"note",'+ textKey: "_text",
'"_attributes":{"importance":"high",'+ cdataKey: "_cdata",
'"logged":"true"},'+ doctypeKey: "doctype",
'"_elements":[{"_type":"element",'+ commentKey: "_comment",
'"_name":"title",'+ parentKey: "_parent",
'"_elements":[{"_type":"text",'+ typeKey: "_type",
'"_text":"Happy"}]},'+ nameKey: "_name",
'{"_type":"element",'+ elementsKey: "_elements"
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Work"}]},'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'{"_type":"element",'+ '"encoding":"utf-8"}},' +
'"_name":"todo",'+ '"_elements":[{"_type":"doctype","doctype":"foo"},' +
'"_elements":[{"_type":"text",'+ '{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
console.info("Telephony_convertxml_ConvertXML_1400 result1 :"+result1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_1500', 0, async function (done) { it('Telephony_convertxml_ConvertXML_1500', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<!--note-->'+ '<!--note-->' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, commentKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"123":"note",'+ instructionKey: "_instruction",
'"_type":"comment"},'+ attributesKey: "_attributes",
'{"_type":"element",'+ textKey: "_text",
'"_name":"note",'+ cdataKey: "_cdata",
'"_attributes":{"importance":"high",'+ doctypeKey: "_doctype",
'"logged":"true"},'+ commentKey: "123",
'"_elements":[{"_type":"element",'+ parentKey: "_parent",
'"_name":"title",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Happy"}]},'+ elementsKey: "_elements"
'{"_type":"element",'+ };
'"_name":"todo",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_elements":[{"_type":"text",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_text":"Work"}]},'+ '"encoding":"utf-8"}},' +
'{"_type":"element",'+ '"_elements":[{"123":"note",' +
'"_name":"todo",'+ '"_type":"comment"},' +
'"_elements":[{"_type":"text",'+ '{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
done(); done();
}) })
...@@ -510,36 +741,51 @@ export default function convertOptionsJsunit() { ...@@ -510,36 +741,51 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <a><b/></a>'+ ' <a><b/></a>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, parentKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"a",'+ commentKey: "_comment",
'"_elements":[{"_type":"element",'+ parentKey: "123",
'"_name":"b"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"title",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Happy"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Work"}]},'+ '"_name":"note",' +
'{"_type":"element",'+ '"_attributes":{"importance":"high",' +
'"_name":"todo",'+ '"logged":"true"},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"a",' +
'"_elements":[{"_type":"element",' +
'"_name":"b"}]},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -552,26 +798,41 @@ export default function convertOptionsJsunit() { ...@@ -552,26 +798,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, typeKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"123":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"123":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"123":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "123",
'{"123":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"123":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"123":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"123":"text",'+ '"_elements":[{"123":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"element",' +
'"_name":"title",' +
'"_elements":[{"123":"text",' +
'"_text":"Happy"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Work"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -584,26 +845,41 @@ export default function convertOptionsJsunit() { ...@@ -584,26 +845,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, nameKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"123":"note",'+ instructionKey: "_instruction",
'"_type":"element",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"123":"title",'+ doctypeKey: "_doctype",
'"_type":"element",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"123":"todo",'+ nameKey: "123",
'"_type":"element",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"123":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_type":"element",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"123":"note",' +
'"_text":"Play"}]}]}]}' '"_type":"element",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"title",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -616,26 +892,41 @@ export default function convertOptionsJsunit() { ...@@ -616,26 +892,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, elementsKey: "123"})); let options = {
var str1 = '{"123":[{"123":[{"123":[{"_type":"text",'+ trim: false,
'"_text":"Happy"}],'+ declarationKey: "_declaration",
'"_type":"element",'+ instructionKey: "_instruction",
'"_name":"title"},'+ attributesKey: "_attributes",
'{"123":[{"_type":"text",'+ textKey: "_text",
'"_text":"Work"}],'+ cdataKey: "_cdata",
'"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"todo"},'+ commentKey: "_comment",
'{"123":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Play"}],'+ typeKey: "_type",
'"_type":"element",'+ nameKey: "_name",
'"_name":"todo"}],'+ elementsKey: "123"
'"_type":"element",'+ };
'"_name":"note",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_attributes":{"importance":"high",'+ var str1 = '{"123":[{"123":[{"123":[{"_type":"text",' +
'"logged":"true"}}],'+ '"_text":"Happy"}],' +
'"_declaration":{"_attributes":{"version":"1.0",'+ '"_type":"element",' +
'"encoding":"utf-8"}}}' '"_name":"title"},' +
'{"123":[{"_type":"text",' +
'"_text":"Work"}],' +
'"_type":"element",' +
'"_name":"todo"},' +
'{"123":[{"_type":"text",' +
'"_text":"Play"}],' +
'"_type":"element",' +
'"_name":"todo"}],' +
'"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"}}],' +
'"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}}}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -648,30 +939,45 @@ export default function convertOptionsJsunit() { ...@@ -648,30 +939,45 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false,trim :true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: true,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_2100', 0, async function (done) { it('Telephony_convertxml_ConvertXML_2100', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -680,28 +986,44 @@ export default function convertOptionsJsunit() { ...@@ -680,28 +986,44 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true})); let options = {
var str1 = '{"_elements":[{"_type":"element",'+ trim: false,
'"_name":"note",'+ declarationKey: "_declaration",
'"_attributes":{"importance":"high",'+ instructionKey: "_instruction",
'"logged":"true"},'+ attributesKey: "_attributes",
'"_elements":[{"_type":"element",'+ textKey: "_text",
'"_name":"title",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"text",'+ doctypeKey: "_doctype",
'"_text":"Happy"}]},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Work"}]},'+ elementsKey: "_elements",
'{"_type":"element",'+ ignoreDeclaration: true
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Play"}]}]}]}' var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_2200', 0,async function (done) { it('Telephony_convertxml_ConvertXML_2200', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -710,24 +1032,40 @@ export default function convertOptionsJsunit() { ...@@ -710,24 +1032,40 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDeclaration: true})); let options = {
var str1 = '{"_elements":[{"_type":"element",'+ trim: false,
'"_name":"note",'+ declarationKey: "_declaration",
'"_attributes":{"importance":"high",'+ instructionKey: "_instruction",
'"logged":"true"},'+ attributesKey: "_attributes",
'"_elements":[{"_type":"element",'+ textKey: "_text",
'"_name":"title",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"text",'+ doctypeKey: "_doctype",
'"_text":"Happy"}]},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Work"}]},'+ elementsKey: "_elements",
'{"_type":"element",'+ ignoreDeclaration: true
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Play"}]}]}]}' var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -740,57 +1078,89 @@ export default function convertOptionsJsunit() { ...@@ -740,57 +1078,89 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreAttributes: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_elements":[{"_type":"element",'+ textKey: "_text",
'"_name":"title",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"text",'+ doctypeKey: "_doctype",
'"_text":"Happy"}]},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Work"}]},'+ elementsKey: "_elements",
'{"_type":"element",'+ ignoreAttributes: true
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Play"}]}]}]}' var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_2400', 0,async function (done) { it('Telephony_convertxml_ConvertXML_2400', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <!--note-->'+ ' <!--note-->' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreComment: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements",
'"_elements":[{"_type":"text",'+ ignoreComment: true
'"_text":"Work"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -798,65 +1168,97 @@ export default function convertOptionsJsunit() { ...@@ -798,65 +1168,97 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <![CDATA[<foo></bar>]]>'+ ' <![CDATA[<foo></bar>]]>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreCDATA: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements",
'"_elements":[{"_type":"text",'+ ignoreCDATA: true
'"_text":"Work"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_2600', 0, async function (done) { it('Telephony_convertxml_ConvertXML_2600', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>'+ '<!DOCTYPE foo>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreDoctype: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements",
'"_elements":[{"_type":"text",'+ ignoreDoctype: true
'"_text":"Work"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -869,20 +1271,36 @@ export default function convertOptionsJsunit() { ...@@ -869,20 +1271,36 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreText: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title"},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"todo"},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo"}]}]}' elementsKey: "_elements",
ignoreText: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title"},' +
'{"_type":"element",' +
'"_name":"todo"},' +
'{"_type":"element",' +
'"_name":"todo"}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -895,26 +1313,41 @@ export default function convertOptionsJsunit() { ...@@ -895,26 +1313,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, declarationKey: "456"})); let options = {
var str1 = '{"456":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "456",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"456":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -922,35 +1355,50 @@ export default function convertOptionsJsunit() { ...@@ -922,35 +1355,50 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <?go there?>'+ ' <?go there?>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, instructionKey: "456"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "456",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"456":"there",'+ doctypeKey: "_doctype",
'"_type":"instruction",'+ commentKey: "_comment",
'"_name":"go"},'+ parentKey: "_parent",
'{"_type":"element",'+ typeKey: "_type",
'"_name":"title",'+ nameKey: "_name",
'"_elements":[{"_type":"text",'+ elementsKey: "_elements"
'"_text":"Happy"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Work"}]},'+ '"_elements":[{"_type":"element",' +
'{"_type":"element",'+ '"_name":"note",' +
'"_name":"todo",'+ '"_attributes":{"importance":"high",' +
'"_elements":[{"_type":"text",'+ '"logged":"true"},' +
'"_text":"Play"}]}]}]}' '"_elements":[{"456":"there",' +
'"_type":"instruction",' +
'"_name":"go"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -958,35 +1406,50 @@ export default function convertOptionsJsunit() { ...@@ -958,35 +1406,50 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <?go there?>'+ ' <?go there?>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, attributesKey: "456"})); let options = {
var str1 = '{"_declaration":{"456":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"456":{"importance":"high",'+ instructionKey: "_instruction",
'"logged":"true"},'+ attributesKey: "456",
'"_type":"element",'+ textKey: "_text",
'"_name":"note",'+ cdataKey: "_cdata",
'"_elements":[{"_type":"instruction",'+ doctypeKey: "_doctype",
'"_name":"go",'+ commentKey: "_comment",
'"_instruction":"there"},'+ parentKey: "_parent",
'{"_type":"element",'+ typeKey: "_type",
'"_name":"title",'+ nameKey: "_name",
'"_elements":[{"_type":"text",'+ elementsKey: "_elements"
'"_text":"Happy"}]},'+ };
'{"_type":"element",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_name":"todo",'+ var str1 = '{"_declaration":{"456":{"version":"1.0",' +
'"_elements":[{"_type":"text",'+ '"encoding":"utf-8"}},' +
'"_text":"Work"}]},'+ '"_elements":[{"456":{"importance":"high",' +
'{"_type":"element",'+ '"logged":"true"},' +
'"_name":"todo",'+ '"_type":"element",' +
'"_elements":[{"_type":"text",'+ '"_name":"note",' +
'"_text":"Play"}]}]}]}' '"_elements":[{"_type":"instruction",' +
'"_name":"go",' +
'"_instruction":"there"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -999,26 +1462,41 @@ export default function convertOptionsJsunit() { ...@@ -999,26 +1462,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, textKey: "456"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "456",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"456":"Happy",'+ parentKey: "_parent",
'"_type":"text"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"456":"Work",'+ };
'"_type":"text"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"456":"Play",'+ '"_elements":[{"_type":"element",' +
'"_type":"text"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"456":"Happy",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"456":"Work",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"456":"Play",' +
'"_type":"text"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -1026,67 +1504,96 @@ export default function convertOptionsJsunit() { ...@@ -1026,67 +1504,96 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <![CDATA[1 is < 2]]>'+ ' <![CDATA[1 is < 2]]>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, cdataKey: "456"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "456",
'"_elements":[{"456":"1 is < 2",'+ doctypeKey: "_doctype",
'"_type":"cdata"},'+ commentKey: "_comment",
'{"_type":"element",'+ parentKey: "_parent",
'"_name":"title",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Happy"}]},'+ elementsKey: "_elements"
'{"_type":"element",'+ };
'"_name":"todo",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_elements":[{"_type":"text",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_text":"Work"}]},'+ '"encoding":"utf-8"}},' +
'{"_type":"element",'+ '"_elements":[{"_type":"element",' +
'"_name":"todo",'+ '"_name":"note",' +
'"_elements":[{"_type":"text",'+ '"_attributes":{"importance":"high",' +
'"_text":"Play"}]}]}]}' '"logged":"true"},' +
'"_elements":[{"456":"1 is < 2",' +
'"_type":"cdata"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
it('Telephony_convertxml_ConvertXML_3300', 0, async function (done) { it('Telephony_convertxml_ConvertXML_3300', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>'+ '<!DOCTYPE foo>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, doctypeKey: 'doctype_next'})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"doctype","doctype_next":"foo"},'+ instructionKey: "_instruction",
'{"_type":"element",'+ attributesKey: "_attributes",
'"_name":"note",'+ textKey: "_text",
'"_attributes":{"importance":"high",'+ cdataKey: "_cdata",
'"logged":"true"},'+ doctypeKey: "doctype_next",
'"_elements":[{"_type":"element",'+ commentKey: "_comment",
'"_name":"title",'+ parentKey: "_parent",
'"_elements":[{"_type":"text",'+ typeKey: "_type",
'"_text":"Happy"}]},'+ nameKey: "_name",
'{"_type":"element",'+ elementsKey: "_elements"
'"_name":"todo",'+ };
'"_elements":[{"_type":"text",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_text":"Work"}]},'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'{"_type":"element",'+ '"encoding":"utf-8"}},' +
'"_name":"todo",'+ '"_elements":[{"_type":"doctype","doctype_next":"foo"},' +
'"_elements":[{"_type":"text",'+ '{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
done(); done();
}) })
...@@ -1094,34 +1601,48 @@ export default function convertOptionsJsunit() { ...@@ -1094,34 +1601,48 @@ export default function convertOptionsJsunit() {
it('Telephony_convertxml_ConvertXML_3400', 0, async function (done) { it('Telephony_convertxml_ConvertXML_3400', 0, async function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<!--note-->'+ '<!--note-->' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, commentKey: "456"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"456":"note",'+ instructionKey: "_instruction",
'"_type":"comment"},'+ attributesKey: "_attributes",
'{"_type":"element",'+ textKey: "_text",
'"_name":"note",'+ cdataKey: "_cdata",
'"_attributes":{"importance":"high",'+ doctypeKey: "_doctype",
'"logged":"true"},'+ commentKey: "456",
'"_elements":[{"_type":"element",'+ parentKey: "_parent",
'"_name":"title",'+ typeKey: "_type",
'"_elements":[{"_type":"text",'+ nameKey: "_name",
'"_text":"Happy"}]},'+ elementsKey: "_elements"
'{"_type":"element",'+ };
'"_name":"todo",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_elements":[{"_type":"text",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_text":"Work"}]},'+ '"encoding":"utf-8"}},' +
'{"_type":"element",'+ '"_elements":[{"456":"note",' +
'"_name":"todo",'+ '"_type":"comment"},' +
'"_elements":[{"_type":"text",'+ '{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
done(); done();
}) })
...@@ -1130,36 +1651,51 @@ export default function convertOptionsJsunit() { ...@@ -1130,36 +1651,51 @@ export default function convertOptionsJsunit() {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <a><b/></a>'+ ' <a><b/></a>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, parentKey: "456"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"a",'+ commentKey: "_comment",
'"_elements":[{"_type":"element",'+ parentKey: "456",
'"_name":"b"}]},'+ typeKey: "_type",
'{"_type":"element",'+ nameKey: "_name",
'"_name":"title",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Happy"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Work"}]},'+ '"_name":"note",' +
'{"_type":"element",'+ '"_attributes":{"importance":"high",' +
'"_name":"todo",'+ '"logged":"true"},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"a",' +
'"_elements":[{"_type":"element",' +
'"_name":"b"}]},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -1172,26 +1708,41 @@ export default function convertOptionsJsunit() { ...@@ -1172,26 +1708,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, typeKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"123":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"123":"element",'+ doctypeKey: "_doctype",
'"_name":"title",'+ commentKey: "_comment",
'"_elements":[{"123":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "123",
'{"123":"element",'+ nameKey: "_name",
'"_name":"todo",'+ elementsKey: "_elements"
'"_elements":[{"123":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"123":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"123":"text",'+ '"_elements":[{"123":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"element",' +
'"_name":"title",' +
'"_elements":[{"123":"text",' +
'"_text":"Happy"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Work"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -1204,26 +1755,41 @@ export default function convertOptionsJsunit() { ...@@ -1204,26 +1755,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, nameKey: "123"})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"123":"note",'+ instructionKey: "_instruction",
'"_type":"element",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":[{"123":"title",'+ doctypeKey: "_doctype",
'"_type":"element",'+ commentKey: "_comment",
'"_elements":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Happy"}]},'+ typeKey: "_type",
'{"123":"todo",'+ nameKey: "123",
'"_type":"element",'+ elementsKey: "_elements"
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"123":"todo",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_type":"element",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"123":"note",' +
'"_text":"Play"}]}]}]}' '"_type":"element",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"title",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -1236,26 +1802,41 @@ export default function convertOptionsJsunit() { ...@@ -1236,26 +1802,41 @@ export default function convertOptionsJsunit() {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, elementsKey: "123"})); let options = {
var str1 = '{"123":[{"123":[{"123":[{"_type":"text",'+ trim: false,
'"_text":"Happy"}],'+ declarationKey: "_declaration",
'"_type":"element",'+ instructionKey: "_instruction",
'"_name":"title"},'+ attributesKey: "_attributes",
'{"123":[{"_type":"text",'+ textKey: "_text",
'"_text":"Work"}],'+ cdataKey: "_cdata",
'"_type":"element",'+ doctypeKey: "_doctype",
'"_name":"todo"},'+ commentKey: "_comment",
'{"123":[{"_type":"text",'+ parentKey: "_parent",
'"_text":"Play"}],'+ typeKey: "_type",
'"_type":"element",'+ nameKey: "_name",
'"_name":"todo"}],'+ elementsKey: "123"
'"_type":"element",'+ };
'"_name":"note",'+ var result1 = JSON.stringify(conv.convert(xml, options));
'"_attributes":{"importance":"high",'+ var str1 = '{"123":[{"123":[{"123":[{"_type":"text",' +
'"logged":"true"}}],'+ '"_text":"Happy"}],' +
'"_declaration":{"_attributes":{"version":"1.0",'+ '"_type":"element",' +
'"encoding":"utf-8"}}}' '"_name":"title"},' +
'{"123":[{"_type":"text",' +
'"_text":"Work"}],' +
'"_type":"element",' +
'"_name":"todo"},' +
'{"123":[{"_type":"text",' +
'"_text":"Play"}],' +
'"_type":"element",' +
'"_name":"todo"}],' +
'"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"}}],' +
'"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}}}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done(); done();
}) })
...@@ -1264,37 +1845,54 @@ export default function convertOptionsJsunit() { ...@@ -1264,37 +1845,54 @@ export default function convertOptionsJsunit() {
* @tc.desc: To convert XML text to JavaScript object. * @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B * @tc.require: AR000GFB5B
*/ */
it('Telephony_convertxml_ConvertXML_3900', 0, function () { it('Telephony_convertxml_ConvertXML_3900', 0, function (done) {
var xml = var xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
' <?go there?>'+ ' <?go there?>' +
' <title>Happy</title>' + ' <title>Happy</title>' +
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var conv = new convertxml.ConvertXML(); var conv = new convertxml.ConvertXML();
var result1 = JSON.stringify(conv.convert(xml, {compact: false, ignoreInstruction: true})); let options = {
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ trim: false,
'"encoding":"utf-8"}},'+ declarationKey: "_declaration",
'"_elements":[{"_type":"element",'+ instructionKey: "_instruction",
'"_name":"note",'+ attributesKey: "_attributes",
'"_attributes":{"importance":"high",'+ textKey: "_text",
'"logged":"true"},'+ cdataKey: "_cdata",
'"_elements":['+ doctypeKey: "_doctype",
'{"_type":"element",'+ commentKey: "_comment",
'"_name":"title",'+ parentKey: "_parent",
'"_elements":[{"_type":"text",'+ typeKey: "_type",
'"_text":"Happy"}]},'+ nameKey: "_name",
'{"_type":"element",'+ elementsKey: "_elements",
'"_name":"todo",'+ ignoreInstruction: true
'"_elements":[{"_type":"text",'+ };
'"_text":"Work"}]},'+ var result1 = JSON.stringify(conv.convert(xml, options));
'{"_type":"element",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"_name":"todo",'+ '"encoding":"utf-8"}},' +
'"_elements":[{"_type":"text",'+ '"_elements":[{"_type":"element",' +
'"_text":"Play"}]}]}]}' '"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1); expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
}) })
}) })
} }
\ No newline at end of file
/** /**
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index' import {describe, it, expect} from '@ohos/hypium';
import data from '@ohos.telephony.data'; import data from '@ohos.telephony.data';
...@@ -22,7 +22,7 @@ export function toString(data) { ...@@ -22,7 +22,7 @@ export function toString(data) {
} else { } else {
return data; return data;
} }
} };
export default function dataJsunit() { export default function dataJsunit() {
describe('dataTest', function () { describe('dataTest', function () {
...@@ -158,8 +158,6 @@ export default function dataJsunit() { ...@@ -158,8 +158,6 @@ export default function dataJsunit() {
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
}); });
} }
......
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,16 +13,14 @@ ...@@ -13,16 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
//other import import convertOptionsJsunit from './ConvertOptionsJsunit.test';
import convertOptionsJsunit from './ConvertOptionsJsunit.test.ets' import radioJsunit from './RadioJsunit.test';
import radioJsunit from './RadioJsunit.test.ets' import radioSecondJsunit from './RadioSecondJsunit.test';
import radioSecondJsunit from './RadioSecondJsunit.test.ets' import smsUiJsunit from './SmsMmsJsunit.test';
import smsUiJsunit from './SmsMmsJsunit.test.ets'; import callJsunit from './CallJsunit.test';
import callJsunit from './CallJsunit.test.ets'; import dataJsunit from './DataJsunit.test';
import dataJsunit from './DataJsunit.test.ets';
export default function testsuite() { export default function testsuite() {
//other
dataJsunit(); dataJsunit();
smsUiJsunit(); smsUiJsunit();
convertOptionsJsunit(); convertOptionsJsunit();
......
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,228 +13,68 @@ ...@@ -14,228 +13,68 @@
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, expect, it } from '@ohos/hypium';
import radio from '@ohos.telephony.radio'; import radio from '@ohos.telephony.radio';
import utils from './Utils.ets'
export default function radioJsunit() { export default function radioJsunit() {
describe('ActsNetworkSearchTest',function () { describe('ActsNetworkSearchTest', function () {
const SLOT_2 = -1;
const SLOT_0 = 0; const SLOT_0 = 0;
/** /**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200 * @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200
* @tc.name Test getPrimarySlotId(-1) to check the callback result * @tc.name Test getPrimarySlotId(-1) to check the callback result
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_NetworkSearch_getPrimarySlotId_Async_0200', 0, async function (done) { it('Telephony_NetworkSearch_getPrimarySlotId_Async_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
radio.getPrimarySlotId((err, data) => { radio.getPrimarySlotId((err, data) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Async_0200 fail: ${err}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Async_0200 err:" + JSON.stringify(err));
expect(data === undefined).assertTrue(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Async_0200 end data: ${data}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Async_0200 data:" + JSON.stringify(data));
expect(data === '').assertTrue(); expect(data == 0 || data == 1).assertTrue();
done(); done();
}); });
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0300 * @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0300
* @tc.name testGetPrimarySlotId_0300 * @tc.name testGetPrimarySlotId_0300
* @tc.desc Test getPrimarySlotId api by promise. * @tc.desc Test getPrimarySlotId api by promise.
*/ */
it('Telephony_NetworkSearch_getPrimarySlotId_Promise_0200', 0, async function (done) { it('Telephony_NetworkSearch_getPrimarySlotId_Promise_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try {
let data = await radio.getPrimarySlotId();
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 pass data: ${data}`);
expect(true).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 fail err: ${err}`);
expect().assertFail();
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_isNrSupported_Promise_0400
* @tc.name Test The function setPrimarySlotId(0)
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isNrSupported_Promise_0400', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try { try {
await radio.isNrSupported(SLOT_0); let data = await radio.getPrimarySlotId();
console.log('radio.isNrSupported(SLOT_0) = ' + radio.isNrSupported(SLOT_0)); console.log("Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 data:" + JSON.stringify(data));
console.log('Telephony_NetworkSearch_isNrSupported_Promise_0400 success'); expect(data == 0 || data == 1).assertTrue();
done(); done();
} catch (err) { } catch (err) {
console.log(`Telephony_NetworkSearch_isNrSupported_Promise_0400 fail ${err}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 err:" + JSON.stringify(err));
done(); expect(false).assertTrue();
}
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0500
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0500', 0, async function (done) {
console.info("Telephony_radio_PreferredNetworkMode_0500 start")
if(utils.notCheck){
done();
return;
}
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_WCDMA === 2).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE === 3).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_WCDMA === 4).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM === 5).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_WCDMA_GSM === 6).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0500 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0600
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0600', 0, async function (done) {
if(utils.notCheck){
done(); done();
return;
} }
console.info("Telephony_radio_PreferredNetworkMode_0600 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_CDMA === 7).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_EVDO === 8).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_EVDO_CDMA === 9).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA === 10).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA === 11).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0600 end")
done();
}); });
/** /**
* @tc.number Telephony_radio_PreferredNetworkMode_0700 * @tc.number Telephony_NetworkSearch_isNrSupported_Promise_0400
* @tc.name Test The PreferredNetworkMode enum * @tc.name Test The function setPrimarySlotId(0)
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_radio_PreferredNetworkMode_0700', 0, async function (done) { it('Telephony_NetworkSearch_isNrSupported_Promise_0400', 0, async function (done) {
if(utils.notCheck){ try {
done(); let result = radio.isNrSupported();
return; console.log("Result: " + result);
} let result0 = radio.isNrSupported(SLOT_0);
console.info("Telephony_radio_PreferredNetworkMode_0700 start") console.log("Result0: " + result0);
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA === 12).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA === 13).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_GSM === 14).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA === 15).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM === 16).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0700 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0800
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0800', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_0800 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA === 17).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM === 18).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA === 19).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM === 20).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA ===21).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0800 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0900
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0900', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_0900 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA === 17).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM === 18).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA === 19).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM === 20).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA ===21).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0900 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_1000
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_1000', 0, async function (done) {
if(utils.notCheck){
done(); done();
return; } catch (err) {
} console.log("Telephony_NetworkSearch_isNrSupported_Promise_0400 err" + JSON.stringify(err));
console.info("Telephony_radio_PreferredNetworkMode_1000 start") expect(false).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA === 22).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR === 31).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE === 32).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_WCDMA === 33).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM ===34).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_1000 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_1100
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_1100', 0, async function (done) {
if(utils.notCheck){
done(); done();
return;
} }
console.info("Telephony_radio_PreferredNetworkMode_1100 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA === 35).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA === 36).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA === 37).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM === 38).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA ===39).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM === 40).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA === 41).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_MAX_VALUE === 99).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_1100 end")
done();
}); });
}) })
} }
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,417 +12,344 @@ ...@@ -13,417 +12,344 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import { describe, expect, it } from '@ohos/hypium';
import radio from '@ohos.telephony.radio'; import radio from '@ohos.telephony.radio';
import utils from './Utils.ets'
export default function radioSecondJsunit() { export default function radioSecondJsunit() {
describe('radioSecondTest', function () { describe('radioSecondTest', function () {
const NROPTION_MODE = [
radio.NR_OPTION_UNKNOWN,
radio.NR_OPTION_NSA_ONLY,
radio.NR_OPTION_SA_ONLY,
radio.NR_OPTION_NSA_AND_SA
];
//Network status
let garrNetworkState = [
radio.NETWORK_UNKNOWN,
radio.NETWORK_AVAILABLE,
radio.NETWORK_CURRENT,
radio.NETWORK_FORBIDDEN,
];
//NetworkRadioTech
let garrNetworkRadioTech = [
'UNKNOWN', 'GSM', '1XRTT', 'WCDMA',
'HSPA', 'HSPAP', 'TD_SCDMA', 'EVDO',
'EHRPD', 'LTE', 'LTE_CA', 'IWLAN', 'NR'];
const SLOT_0 = 0;
const SLOT_1 = 5;
const SLOT_2 = 2;
const SLOT_3 = -1;
const NETWORK_TYPES = [ const NETWORK_TYPES = [
radio.NETWORK_TYPE_UNKNOWN, radio.NetworkType.NETWORK_TYPE_UNKNOWN,
radio.NETWORK_TYPE_GSM, radio.NetworkType.NETWORK_TYPE_GSM,
radio.NETWORK_TYPE_CDMA, radio.NetworkType.NETWORK_TYPE_CDMA,
radio.NETWORK_TYPE_WCDMA, radio.NetworkType.NETWORK_TYPE_WCDMA,
radio.NETWORK_TYPE_TDSCDMA, radio.NetworkType.NETWORK_TYPE_TDSCDMA,
radio.NETWORK_TYPE_LTE, radio.NetworkType.NETWORK_TYPE_LTE,
radio.NETWORK_TYPE_NR, radio.NetworkType.NETWORK_TYPE_NR,
]; ];
const NETWORK_SIGNAL = [0, 1, 2, 3, 4, 5]; const NETWORK_SIGNAL = [0, 1, 2, 3, 4, 5];
const CELL_LAC_TAC_MAX = 0xffff;
const CELL_CELLID_MAX = 0xfffffff;
const CELL_GSM_CELLID_MAX = 0xffff;
const CELL_ARFCN_MAX = 1023;
const CELL_EARFCN_MAX = 41589;
const CELL_BSIC_MAX = 63;
const CELL_PSC_MAX = 511;
const CELL_PCI_MAX = 503;
const CELL_MCC = 460;
const CELL_MNC_MAX = 20;
const CELL_INFO_MIN = 0;
const TIME_RADIO_TURNON = 10000;
console.log("************* radio Test start*************"); console.log("************* radio Test start*************");
/** /**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0100 * @tc.number Telephony_NetworkSearch_NetworkState_Async_0100
* @tc.name Test getNrOptionMode() to check the callback result * @tc.name Test getNrOptionMode() to check the callback result
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_NetworkSearch_NetworkState_Async_0100', 0, async function (done) { it('Telephony_NetworkSearch_NetworkState_Async_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getNetworkState((err, data) => { radio.getNetworkState((err, data) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_NetworkState_Async_0100 get fail err: ${err}`); console.error("Network unavailable");
expect().assertFail(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.log(`Telephony_NetworkSearch_NetworkState_Async_0100 end data: ${JSON.stringify(data)}`); console.log("Telephony_NetworkSearch_NetworkState_Async_0100 end data:" + JSON.stringify(data));
if (true) { expect(data.longOperatorName === "longOperatorName").assertFalse();
console.log(`Telephony_NetworkSearch_getNrOptionMode_Async_0100 1`); expect(data.shortOperatorName === "shortOperatorName").assertFalse();
expect(true).assertTrue(); expect(data.plmnNumeric === "plmnNumeric").assertFalse();
done(); expect(data.isRoaming === true || data.isRoaming === false).assertTrue();
return; expect(data.isCaActive === true || data.isCaActive === false).assertTrue();
} else { expect(data.isEmergency === true || data.isEmergency === false).assertTrue();
expect(NROPTION_MODE).assertContain(data); expect(data.cfgTech === -1).assertFalse();
expect(NROPTION_MODE).assertContain(data.cfgTech); expect(data.nsaState === -1).assertFalse();
done(); expect(data.regState === -1).assertFalse();
} done();
return;
}); });
}) })
/** /**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0300 * @tc.number Telephony_NetworkSearch_NetworkState_Async_0300
* @tc.name testGetNetworkState_0300 * @tc.name testGetNetworkState_0300
* @tc.desc Test getNetworkState api by promise. * @tc.desc Test getNetworkState api by promise.
*/ */
it('Telephony_NetworkSearch_NetworkState_Promise_0100', 0, async function (done) { it('Telephony_NetworkSearch_NetworkState_Promise_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try { try {
const result = await radio.getNetworkState(); const result = await radio.getNetworkState();
expect(true).assertTrue(); console.log("Telephony_NetworkSearch_NetworkState_Promise_0100 result:" + JSON.stringify(result));
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0100 test finish.`); expect(result.longOperatorName === "longOperatorName").assertFalse();
expect(result.shortOperatorName === "shortOperatorName").assertFalse();
expect(result.plmnNumeric === "plmnNumeric").assertFalse();
expect(result.isRoaming === true || result.isRoaming === false).assertTrue();
expect(result.isCaActive === true || result.isCaActive === false).assertTrue();
expect(result.isEmergency === true || result.isEmergency === false).assertTrue();
expect(result.cfgTech === -1).assertFalse();
expect(result.nsaState === -1).assertFalse();
expect(result.regState === -1).assertFalse();
done();
} catch (error) { } catch (error) {
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0100 error: ${error.message}`); console.error("Network unavailable");
expect().assertFail(); expect(false).assertTrue();
done();
} }
done();
}) })
/** /**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0200 * @tc.number Telephony_NetworkSearch_NetworkState_Async_0200
* @tc.name testGetNetworkState_0200 * @tc.name testGetNetworkState_0200
* @tc.desc Test getNetworkState() api by callback, slotId is 0, to check the callback result * @tc.desc Test getNetworkState() api by callback, slotId is 0, to check the callback result
*/ */
it('Telephony_NetworkSearch_NetworkState_Async_0200', 0, async function (done) { it('Telephony_NetworkSearch_NetworkState_Async_0200', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getNetworkState(0, (err, data) => { radio.getNetworkState(0, (err, data) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_NetworkState_Async_0200 get fail err: ${err}`); console.error("Network unavailable");
expect().assertFail(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.log(`Telephony_NetworkSearch_NetworkState_Async_0200 end data: ${JSON.stringify(data)}`); console.log("Telephony_NetworkSearch_NetworkState_Async_0200 end data:" + JSON.stringify(data));
expect(true).assertTrue(); expect(data.longOperatorName === "longOperatorName").assertFalse();
expect(data.shortOperatorName === "shortOperatorName").assertFalse();
expect(data.plmnNumeric === "plmnNumeric").assertFalse();
expect(data.isRoaming === true || data.isRoaming === false).assertTrue();
expect(data.isCaActive === true || data.isCaActive === false).assertTrue();
expect(data.isEmergency === true || data.isEmergency === false).assertTrue();
expect(data.cfgTech === -1).assertFalse();
expect(data.nsaState === -1).assertFalse();
expect(data.regState === -1).assertFalse();
done(); done();
return;
}); });
}) })
/** /**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0400 * @tc.number Telephony_NetworkSearch_NetworkState_Async_0400
* @tc.name testGetNetworkState_0400 * @tc.name testGetNetworkState_0400
* @tc.desc Test getNetworkState() api by promise, slotId is 0, to check the callback result * @tc.desc Test getNetworkState() api by promise, slotId is 0, to check the callback result
*/ */
it('Telephony_NetworkSearch_NetworkState_Promise_0200', 0, async function (done) { it('Telephony_NetworkSearch_NetworkState_Promise_0200', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try { try {
const result = await radio.getNetworkState(0); const result = await radio.getNetworkState(0);
expect(true).assertTrue(); console.log("Telephony_NetworkSearch_NetworkState_Promise_0200 result:" + JSON.stringify(result));
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0200 test finish.`); expect(result.longOperatorName === "longOperatorName").assertFalse();
expect(result.shortOperatorName === "shortOperatorName").assertFalse();
expect(result.plmnNumeric === "plmnNumeric").assertFalse();
expect(result.isRoaming === true || result.isRoaming === false).assertTrue();
expect(result.isCaActive === true || result.isCaActive === false).assertTrue();
expect(result.isEmergency === true || result.isEmergency === false).assertTrue();
expect(result.cfgTech === -1).assertFalse();
expect(result.nsaState === -1).assertFalse();
expect(result.regState === -1).assertFalse();
done();
} catch (error) { } catch (error) {
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0200 error: ${error.message}`); console.error("Network unavailable");
expect().assertFail(); expect(false).assertTrue();
done();
} }
done();
}) })
/** /**
* @tc.number Telephony_Radio_CdmaCellInformation_sid_0100 * @tc.number Telephony_Radio_CdmaCellInformation_sid_0100
* @tc.name sid * @tc.name sid
* @tc.desc sid test * @tc.desc sid test
*/ */
it('Telephony_Radio_CdmaCellInformation_sid_0100', 0, async function (done) { it('Telephony_Radio_CdmaCellInformation_sid_0100', 0, async function (done) {
console.log("-----------------------Telephony_Radio_CdmaCellInformation_sid_0100 start-----------------------"); console.log("-----------------------Telephony_Radio_CdmaCellInformation_sid_0100 start-----------------------");
if (utils.notCheck) { let cdmaCellInformation = {
expect(true).assertTrue();
done();
return;
}
let cdmaCellInformatio = {
baseId: 1, baseId: 1,
latitude: 39, latitude: 39,
longitude: 116, longitude: 116,
nid: 101, nid: 101,
sid: 102 sid: 102
} };
expect(101).assertEqual(cdmaCellInformatio.nid); expect(101).assertEqual(cdmaCellInformation.nid);
expect(102).assertEqual(cdmaCellInformatio.sid); expect(102).assertEqual(cdmaCellInformation.sid);
done();
console.log("-----------------------Telephony_Radio_CdmaCellInformation_sid_0100 end-----------------------"); console.log("-----------------------Telephony_Radio_CdmaCellInformation_sid_0100 end-----------------------");
}) })
/** /**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500 * @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500
* @tc.name TestGetRadioTech_0500 * @tc.name TestGetRadioTech_0500
* @tc.desc Test getRadioTech() api by callback .SlotId parameter input is 0 * @tc.desc Test getRadioTech() api by callback .SlotId parameter input is 0
*/ */
it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function(done){ it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function (done) {
let slotId = 0; let slotId = 0;
radio.getRadioTech(slotId, (err, data) =>{ radio.getRadioTech(slotId, (err, data) => {
expect(JSON.stringify(data) != null).assertTrue(); if (err) {
console.info(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.error("Telephony_NetworkSearch_getRadioTech_Async_0500 err:" + JSON.stringify(err));
expect(true).assertEqual(false);
done();
return;
}
console.error("Telephony_NetworkSearch_getRadioTech_Async_0500 data:" + JSON.stringify(data));
expect(data.psRadioTech === -1).assertFalse();
expect(data.csRadioTech === -1).assertFalse();
done();
}); });
done();
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500 * @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500
* @tc.name TestGetRadioTech_0500 * @tc.name TestGetRadioTech_0500
* @tc.desc SlotId parameter input is 0 ,Test getRadioTech() api by promise * @tc.desc SlotId parameter input is 0 ,Test getRadioTech() api by promise
*/ */
it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function(done){ it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function (done) {
let slotId = 0; let slotId = 0;
let promise = radio.getRadioTech(slotId); let promise = radio.getRadioTech(slotId);
promise.then(data => { promise.then(data => {
expect(JSON.stringify(data) != null).assertTrue(); console.error("Telephony_NetworkSearch_getRadioTech_Async_0500 data:" + JSON.stringify(data));
console.info(`getRadioTech success, data->${JSON.stringify(data)}`); expect(data.psRadioTech === -1).assertFalse();
expect(data.csRadioTech === -1).assertFalse();
done();
}).catch(err => { }).catch(err => {
console.info(`getRadioTech fail, err->${JSON.stringify(err)}`); console.error("Telephony_NetworkSearch_getRadioTech_Async_0500 err:" + JSON.stringify(err));
expect(true).assertEqual(false);
done();
}); });
done();
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600 * @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600
* @tc.name testGetNetworkSelectionMode_0600 * @tc.name testGetNetworkSelectionMode_0600
* @tc.desc SlotId parameter input is 0, test getNetworkSelectionMode() api by callback. * @tc.desc SlotId parameter input is 0, test getNetworkSelectionMode() api by callback.
*/ */
it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600', 0, async function (done) { it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600', 0, async function (done) {
if (utils.notCheck) { let slotId = 0;
expect(true).assertTrue(); radio.getNetworkSelectionMode(slotId, (err, data) => {
done();
return;
}
radio.getNetworkSelectionMode(0, (err, res) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600 err: ${err}`); console.error("Telephony_NetworkSearch_getRadioTech_Async_0500 err:" + JSON.stringify(err));
expect().assertFail();
done();
} else {
console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600 pass ${res}');
expect(true).assertTrue();
done(); done();
return;
} }
console.error("Telephony_NetworkSearch_getRadioTech_Async_0500 data:" + JSON.stringify(data));
expect(data == radio.NetworkSelectionMode.NETWORK_SELECTION_AUTOMATIC ||
data == radio.NetworkSelectionMode.NETWORK_SELECTION_MANUAL ||
data == radio.NetworkSelectionMode.NETWORK_SELECTION_UNKNOWN).assertTrue();
done();
}); });
done();
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0700 * @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0700
* @tc.name testGetNetworkSelectionMode_0700 * @tc.name testGetNetworkSelectionMode_0700
* @tc.desc SlotId parameter input is 0, test getNetworkSelectionMode() api by promise. * @tc.desc SlotId parameter input is 0, test getNetworkSelectionMode() api by promise.
*/ */
it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600', 0, async function (done) { it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600', 0, async function (done) {
if (utils.notCheck) { let slotId = 0;
expect(true).assertTrue(); let promise = radio.getNetworkSelectionMode(slotId);
promise.then(data => {
console.log("getNetworkSelectionMode success, promise: data:" + JSON.stringify(data));
expect(data == radio.NetworkSelectionMode.NETWORK_SELECTION_AUTOMATIC ||
data == radio.NetworkSelectionMode.NETWORK_SELECTION_MANUAL ||
data == radio.NetworkSelectionMode.NETWORK_SELECTION_UNKNOWN).assertTrue();
done(); done();
return; }).catch(err => {
} console.log("getNetworkSelectionMode failed, promise: err:" + JSON.stringify(err));
try {
await radio.getNetworkSelectionMode(0);
console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600 pass');
expect(true).assertTrue();
} catch (err) {
console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600 fail: ${err}');
expect().assertFail();
done(); done();
return; });
} done();
done();
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 * @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500
* @tc.name testGetISOCountryCodeForNetwork_0500 * @tc.name testGetISOCountryCodeForNetwork_0500
* @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by callback. * @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by callback.
*/ */
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500', 0, async function (done) { it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getISOCountryCodeForNetwork(0, (err, data) => { radio.getISOCountryCodeForNetwork(0, (err, data) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 fail err: ${err}`); console.log("Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 fail err:" + JSON.stringify(err));
expect().assertFail(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.log( console.log(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 finish data: ${JSON.stringify(data)}`); "Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 finish data:" + JSON.stringify(data));
expect(true).assertTrue(); expect(data == undefined).assertFalse();
done(); done();
}); });
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0600 * @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0600
* @tc.name testGetISOCountryCodeForNetwork_0600 * @tc.name testGetISOCountryCodeForNetwork_0600
* @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by promise. * @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by promise.
*/ */
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500', 0, async function (done) { it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try { try {
let data = await radio.getISOCountryCodeForNetwork(0); let data = await radio.getISOCountryCodeForNetwork(0);
console.log( console.log(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 finish data:${JSON.stringify(data)}`); "Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 finish data:" + JSON.stringify(data));
expect(true).assertTrue(); expect(data == undefined).assertFalse();
done();
} catch (err) { } catch (err) {
console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 fail err: ${err}`); console.log("Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 fail err:" + JSON.stringify(err));
expect().assertFail(); expect(false).assertTrue();
done(); done();
return;
} }
done();
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0500 * @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0500
* @tc.name testGetSignalInformation_0500 * @tc.name testGetSignalInformation_0500
* @tc.desc SlotId parameter input is 0, test getSignalInformation() api by callback. * @tc.desc SlotId parameter input is 0, test getSignalInformation() api by callback.
*/ */
it('Telephony_NetworkSearch_getSignalInformation_Async_0500', 0, async function (done) { it('Telephony_NetworkSearch_getSignalInformation_Async_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getSignalInformation(0, (err, data) => { radio.getSignalInformation(0, (err, data) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0500 fail err: ${err}`); console.log("Telephony_NetworkSearch_getSignalInformation_Async_0500 fail err:" + JSON.stringify(err));
expect().assertFail(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0500 finish data: ${JSON.stringify(data)}`); console.log(
expect(true).assertTrue(); "Telephony_NetworkSearch_getSignalInformation_Async_0500 finish data:" + JSON.stringify(data));
expect(data == undefined).assertFalse();
done(); done();
}); });
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0600 * @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0600
* @tc.name testGetSignalInformation_0600 * @tc.name testGetSignalInformation_0600
* @tc.desc SlotId parameter input is 0, test getSignalInformation() api by promise. * @tc.desc SlotId parameter input is 0, test getSignalInformation() api by promise.
*/ */
it('Telephony_NetworkSearch_getSignalInformation_Promise_0500', 0, async function (done) { it('Telephony_NetworkSearch_getSignalInformation_Promise_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try { try {
let data = await radio.getSignalInformation(0); let data = await radio.getSignalInformation(0);
console.log( console.log(
`Telephony_NetworkSearch_getSignalInformation_Promise_0500 pass data: ${JSON.stringify(data)}`); "Telephony_NetworkSearch_getSignalInformation_Promise_0500 finish data:" + JSON.stringify(data));
expect(true).assertTrue(); expect(data == undefined).assertFalse();
radio.getCellInformation(0, (err, data) => {
if (!err && data.length > 0) {
assertCellInformation(data);
}
});
done();
} catch (err) { } catch (err) {
console.log(`Telephony_NetworkSearch_getSignalInformation_Promise_0500 fail err: ${err}`); console.log("Telephony_NetworkSearch_getSignalInformation_Promise_0500 fail err:" + JSON.stringify(err));
expect().assertFail(); expect(false).assertTrue();
done(); done();
return;
} }
done();
}); });
console.log("************* radio Test end*************"); console.log("************* radio Test end*************");
function assertCellInformation(data) { function assertCellInformation(data) {
expect(data !== '' && data != undefined && data != null).assertTrue(); expect(data !== '' && data != undefined && data != null).assertTrue();
expect(data.length).assertLarger(0); expect(data.length).assertLarger(0);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
expect(NETWORK_TYPES).assertContain(data[i].networkType); expect(NETWORK_TYPES).assertContain(data[i].networkType);
expect(data[i].isCamped).assertTrue(); expect(data[i].isCamped == true || data[i].isCamped == false).assertTrue();
expect(data[i].timeStamp).assertLarger(0); expect(data[i].timeStamp).assertLarger(0);
expect(NETWORK_TYPES).assertContain(data[i].signalInformation.signalType); expect(NETWORK_TYPES).assertContain(data[i].signalInformation.signalType);
expect(NETWORK_SIGNAL).assertContain(data[i].signalInformation.signalLevel); expect(NETWORK_SIGNAL).assertContain(data[i].signalInformation.signalLevel);
expect(data[i].data != undefined && data[i].data != '' && data[i].data != null).assertTrue(); expect(data[i].data != undefined && data[i].data != '' && data[i].data != null).assertTrue();
if (data[0].networkType === radio.NETWORK_TYPE_LTE) { if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_LTE) {
expect(data[i].data.tac >= CELL_INFO_MIN && data[i].data.tac <= CELL_LAC_TAC_MAX).assertTrue(); console.log("radio.NetworkType.NETWORK_TYPE_LTE:" + radio.NetworkType.NETWORK_TYPE_LTE);
expect(data[i].data.cgi >= CELL_INFO_MIN && data[i].data.cgi <= CELL_CELLID_MAX).assertTrue(); } else if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_WCDMA) {
expect(data[i].data.earfcn >= CELL_INFO_MIN && data[i].data.earfcn <= CELL_EARFCN_MAX).assertTrue(); console.log("radio.NetworkType.NETWORK_TYPE_WCDMA:" + radio.NetworkType.NETWORK_TYPE_WCDMA);
expect(data[i].data.pci >= CELL_INFO_MIN && data[i].data.pci <= CELL_PCI_MAX).assertTrue(); } else if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_GSM) {
expect(data[i].data.mnc >= CELL_INFO_MIN && data[i].data.mnc <= CELL_MNC_MAX).assertTrue(); console.log("radio.NetworkType.NETWORK_TYPE_GSM:" + radio.NetworkType.NETWORK_TYPE_GSM);
expect(data[i].data.bandwidth >= CELL_INFO_MIN && data[i].data.bandwidth <= CELL_MNC_MAX).assertTrue(); } else if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_TDSCDMA) {
expect(data[i].data.isSupportEndc >= CELL_INFO_MIN && data[i].data.isSupportEndc <= CELL_MNC_MAX).assertTrue(); console.log("radio.NetworkType.NETWORK_TYPE_TDSCDMA:" + radio.NetworkType.NETWORK_TYPE_TDSCDMA);
expect(data[i].data.mcc).assertEqual(CELL_MCC); } else if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_NR) {
} else if (data[i].networkType === radio.NETWORK_TYPE_WCDMA) { console.log("radio.NetworkType.NETWORK_TYPE_NR:" + radio.NetworkType.NETWORK_TYPE_NR);
expect(data[i].data.lac >= CELL_INFO_MIN && data[i].data.lac <= CELL_LAC_TAC_MAX).assertTrue();
expect(data[i].data.cellId >= CELL_INFO_MIN && data[i].data.cellId <= CELL_CELLID_MAX).assertTrue();
expect(data[i].data.uarfcn >= CELL_INFO_MIN && data[i].data.uarfcn <= CELL_ARFCN_MAX).assertTrue();
expect(data[i].data.psc >= CELL_INFO_MIN && data[i].data.psc <= CELL_PSC_MAX).assertTrue();
expect(data[i].data.mnc >= CELL_INFO_MIN && data[i].data.mnc <= CELL_MNC_MAX).assertTrue();
expect(data[i].data.cpid >= CELL_INFO_MIN && data[i].data.cpid <= CELL_MNC_MAX).assertTrue();
expect(data[i].data.mcc).assertEqual(CELL_MCC);
} else if (data[i].networkType === radio.NETWORK_TYPE_GSM) {
expect(data[i].data.lac >= CELL_INFO_MIN && data[i].data.lac <= CELL_LAC_TAC_MAX).assertTrue();
expect(data[i].data.cellId >= CELL_INFO_MIN && data[i].data.cellId <= CELL_GSM_CELLID_MAX).assertTrue();
expect(data[i].data.arfcn >= CELL_INFO_MIN && data[i].data.arfcn <= CELL_ARFCN_MAX).assertTrue();
expect(data[i].data.bsic >= CELL_INFO_MIN && data[i].data.bsic <= CELL_BSIC_MAX).assertTrue();
expect(data[i].data.mnc >= CELL_INFO_MIN && data[i].data.mnc <= CELL_MNC_MAX).assertTrue();
expect(data[i].data.mcc).assertEqual(CELL_MCC);
} else if (data[i].networkType === radio.NETWORK_TYPE_TDSCDMA) {
expect(data[i].data.baseId >= CELL_INFO_MIN && data[i].data.baseId <= CELL_LAC_TAC_MAX).assertTrue();
expect(data[i].data.latitude >= CELL_INFO_MIN && data[i].data.latitude <= CELL_GSM_CELLID_MAX).assertTrue();
expect(data[i].data.longitude >= CELL_INFO_MIN && data[i].data.longitude <= CELL_ARFCN_MAX).assertTrue();
expect(data[i].data.bsic >= CELL_INFO_MIN && data[i].data.bsic <= CELL_BSIC_MAX).assertTrue();
expect(data[i].data.nid >= CELL_INFO_MIN && data[i].data.nid <= CELL_MNC_MAX).assertTrue();
expect(data[i].data.mcc).assertEqual(CELL_MCC);
} else if (data[i].networkType === radio.NETWORK_TYPE_NR) {
expect(data[i].data.nrArfcn >= CELL_INFO_MIN && data[i].data.nrArfcn <= CELL_LAC_TAC_MAX).assertTrue();
expect(data[i].data.tac >= CELL_INFO_MIN && data[i].data.tac <= CELL_GSM_CELLID_MAX).assertTrue();
expect(data[i].data.nci >= CELL_INFO_MIN && data[i].data.nci <= CELL_ARFCN_MAX).assertTrue();
expect(data[i].data.mcc).assertEqual(CELL_MCC);
} else { } else {
expect().assertFail(); console.log("radio.NetworkType.NETWORK_TYPE_UNKNOWN:" + radio.NetworkType.NETWORK_TYPE_UNKNOWN);
} }
} }
} }
}) })
......
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,30 +12,18 @@ ...@@ -13,30 +12,18 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import { describe, expect, it } from '@ohos/hypium';
import mms from '@ohos.telephony.sms'; import sms from '@ohos.telephony.sms';
import utils from './Utils.ets'
export default function smsUiJsunit() { export default function smsUiJsunit() {
describe('appInfoTest', function () { describe('smsUiJsunit', function () {
const SMS_SEND_DST_NUMBER = '';
const TRUE_SLOT_ID = 0;
const FALSE_SLOT_ID = 9;
const OTHER_SLOT_ID = 1;
const SECOND_SLOT_ID = 2;
const IDENTIFIER_MIN = 0;
const IDENTIFIER_MAX = 0xFFFF;
const RANTYPE_GSM = 1;
const RANTYPE_CDMA = 2;
const RANTYPE_ERROR = 3;
var rawArray = [ var rawArray = [
0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91, 0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91,
0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80, 0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80,
0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30 0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30
] ];
/* /*
* @tc.number Telephony_SmsMms_createMessage_Async_0100 * @tc.number Telephony_SmsMms_createMessage_Async_0100
* @tc.name Call interface CreateMessage, * @tc.name Call interface CreateMessage,
...@@ -45,11 +32,6 @@ export default function smsUiJsunit() { ...@@ -45,11 +32,6 @@ export default function smsUiJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) { it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp', (err, shortMessage) => { sms.createMessage(rawArray, '3gpp', (err, shortMessage) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
...@@ -57,74 +39,59 @@ export default function smsUiJsunit() { ...@@ -57,74 +39,59 @@ export default function smsUiJsunit() {
done(); done();
return; return;
} }
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue(); console.log("dxj fail shortMessage:" + JSON.stringify(shortMessage));
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.visibleMessageBody == "Aa").assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue(); console.log("dxj fail visibleMessageBody:" + shortMessage.visibleMessageBody);
expect(shortMessage.protocolId === 0).assertTrue(); expect(shortMessage.visibleRawAddress.length !== 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue(); console.log("dxj fail visibleRawAddress:" + shortMessage.visibleRawAddress);
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue(); expect(shortMessage.messageClass !== -1).assertTrue();
console.log("dxj fail messageClass:" + shortMessage.messageClass);
expect(shortMessage.protocolId !== -1).assertTrue();
console.log("dxj fail protocolId:" + shortMessage.protocolId);
expect(shortMessage.scAddress.length !== 0).assertTrue();
console.log("dxj fail scAddress:" + shortMessage.scAddress);
expect(shortMessage.scTimestamp !== 0).assertTrue();
console.log("dxj fail scTimestamp:" + shortMessage.scTimestamp);
expect(shortMessage.isReplaceMessage).assertFalse(); expect(shortMessage.isReplaceMessage).assertFalse();
console.log("dxj fail isReplaceMessage:" + shortMessage.isReplaceMessage);
expect(shortMessage.hasReplyPath).assertFalse(); expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue(); console.log("dxj fail hasReplyPath:" + shortMessage.hasReplyPath);
expect(shortMessage.status === 0).assertTrue(); expect(shortMessage.pdu == undefined).assertFalse();
console.log("dxj fail pdu:" + shortMessage.pdu);
expect(shortMessage.status !== -1).assertTrue();
console.log("dxj fail status:" + shortMessage.status);
expect(shortMessage.isSmsStatusReportMessage).assertTrue(); expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Async_0100 finish'); console.log("dxj fail isSmsStatusReportMessage:" + shortMessage.isSmsStatusReportMessage);
done(); done();
}); });
}); });
/* /*
* @tc.number Telephony_SmsMms_createMessage_Async_0300 * @tc.number Telephony_SmsMms_createMessage_Async_0300
* @tc.name testCreateMessage_0300 * @tc.name testCreateMessage_0300
* @tc.desc Call interface CreateMessage, * @tc.desc Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP, * pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty * shortMessage Don't empty
*/ */
it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) { it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp').then(shortMessage => { sms.createMessage(rawArray, '3gpp').then(shortMessage => {
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue(); expect(shortMessage.visibleMessageBody == "Aa").assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.visibleRawAddress.length !== 0).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue(); expect(shortMessage.messageClass !== -1).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue(); expect(shortMessage.protocolId !== -1).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.scAddress.length !== 0).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue(); expect(shortMessage.scTimestamp !== 0).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse(); expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse(); expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue(); expect(shortMessage.pdu == undefined).assertFalse();
expect(shortMessage.status === 0).assertTrue(); expect(shortMessage.status !== -1).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue(); expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Promise_0100 finish');
done(); done();
}).catch(err => { }).catch(err => {
expect().assertFail(); expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0100 fail'); console.log('Telephony_SmsMms_createMessage_Promise_0100 fail' + JSON.stringify(err));
done();
return;
});
});
/*
* @tc.number Telephony_SmsMms_getSmsEncodingScheme_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsEncodingScheme_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done(); done();
return; });
}
expect(sms.SMS_ENCODING_UNKNOWN == 0).assertTrue();
expect(sms.SMS_ENCODING_7BIT == 1).assertTrue();
expect(sms.SMS_ENCODING_8BIT == 2).assertTrue();
expect(sms.SMS_ENCODING_16BIT == 3).assertTrue();
done();
}); });
/* /*
...@@ -133,18 +100,10 @@ export default function smsUiJsunit() { ...@@ -133,18 +100,10 @@ export default function smsUiJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) { it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) {
if (true) { expect(sms.SendSmsResult.SEND_SMS_SUCCESS == 0).assertTrue();
expect(true).assertTrue(); expect(sms.SendSmsResult.SEND_SMS_FAILURE_UNKNOWN == 1).assertTrue();
done(); expect(sms.SendSmsResult.SEND_SMS_FAILURE_RADIO_OFF == 2).assertTrue();
return; expect(sms.SendSmsResult.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 3).assertTrue();
}
expect(sms.SEND_SMS_SUCCESS == 0).assertTrue();
expect(sms.SEND_SMS_FAILURE_UNKNOWN == 1).assertTrue();
expect(sms.SEND_SMS_FAILURE_RADIO_OFF == 2).assertTrue();
expect(sms.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 3).assertTrue();
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done(); done();
}); });
...@@ -154,41 +113,11 @@ export default function smsUiJsunit() { ...@@ -154,41 +113,11 @@ export default function smsUiJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) { it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) {
if (true) { expect(sms.ShortMessageClass.UNKNOWN == 0).assertTrue();
expect(true).assertTrue(); expect(sms.ShortMessageClass.INSTANT_MESSAGE == 1).assertTrue();
done(); expect(sms.ShortMessageClass.OPTIONAL_MESSAGE == 2).assertTrue();
return; expect(sms.ShortMessageClass.SIM_MESSAGE == 3).assertTrue();
} expect(sms.ShortMessageClass.FORWARD_MESSAGE == 4).assertTrue();
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_getMmsCharSets_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getMmsCharSets_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.BIG5 == 0X07EA).assertTrue();
expect(sms.ISO_10646_UCS_2 == 0X03E8).assertTrue();
expect(sms.ISO_8859_1 == 0X04).assertTrue();
expect(sms.ISO_8859_2 == 0X05).assertTrue();
expect(sms.ISO_8859_3 == 0X06).assertTrue();
expect(sms.ISO_8859_4 == 0X07).assertTrue();
expect(sms.ISO_8859_5 == 0X08).assertTrue();
expect(sms.ISO_8859_6 == 0X09).assertTrue();
expect(sms.ISO_8859_7 == 0X10).assertTrue();
expect(sms.ISO_8859_8 == 0X12).assertTrue();
expect(sms.ISO_8859_9 == 0X13).assertTrue();
expect(sms.SHIFT_JIS == 0X11).assertTrue();
expect(sms.US_ASCII == 0X03).assertTrue();
expect(sms.UTF_8 == 0X6A).assertTrue();
done(); done();
}); });
}) })
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static notCheck = true;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
/**
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// sim slot id
export const DEFAULT_SLOTID = 0;
export const SLOTID3 = 3;
export const SLOTID2 = 2;
export const SLOTID_MINUS1 = -1;
// sim correct password
export const CORRECT_PIN = '1234';
export const CORRECT_PIN2 = '18099014';
// sim incorrect password
export const INCORRECT_PIN = '134679';
export const INCORRECT_PIN_LEN3 = '123';
export const INCORRECT_PUK = '134679';
export const INCORRECT_PIN2 = '134679';
export const INCORRECT_PIN2_LEN3 = '123';
export const INCORRECT_PIN2_LEN9 = '123456789';
export const INCORRECT_PUK2 = '134679';
// lock status response
export const LOCK_RESULT = { SUCCESS: 0, FAILURE: -1, EXCEPTION: -2 };
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册