提交 28b808e3 编写于 作者: B bayanxing

add test cases

Signed-off-by: Nbayanxing <bayanxing@kaihongdigi.com>
上级 08f0140d
......@@ -862,6 +862,48 @@ describe('CallManageImsCall', function () {
}
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumber_Async_0120
* @tc.name PhoneNumber is 13900000000, options: CN, Call formatPhoneNumber() to format the number.
* The return value is 10 000 000 0000
* @tc.desc Function test
*/
it('Telephony_CallManager_formatPhoneNumber_Async_0120', 0, async function (done) {
let numberFormatOptions = new NumberFormatOptions('CN');
call.formatPhoneNumber('13900000000', numberFormatOptions, (err, data) => {
if (err) {
console.log(`Telephony_CallManager_formatPhoneNumber_Async_0120 err = ${err.message}`);
console.log('Telephony_CallManager_formatPhoneNumber_Async_0120 fail');
expect().assertFail();
done();
return;
}
expect(data === '139 0000 0000"').assertTrue();
console.log(`Telephony_CallManager_formatPhoneNumber_Async_0120 finish data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0120
* @tc.name PhoneNumber is 13900000000, options: US, Call formatPhoneNumber() to format the number.
* The return value is 200 0000
* @tc.desc Function test
*/
it('Telephony_CallManager_formatPhoneNumber_Promise_0120', 0, async function (done) {
let numberFormatOptions = new NumberFormatOptions('US');
try {
var data = await call.formatPhoneNumber('13900000000', numberFormatOptions);
expect(data === '1 390-000-0000').assertTrue();
console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0120 finish data = ${data}`);
done();
} catch (err) {
console.log('Telephony_CallManager_formatPhoneNumber_Promise_0120 fail');
expect().assertFail();
done();
}
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0100
* @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumberToE164() to format the number,
......@@ -942,4 +984,41 @@ describe('CallManageImsCall', function () {
done();
}
});
/**
* @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1400
* @tc.name PhoneNumber: 110, no options. Call isEmergencyPhoneNumber() to check whether it is an emergency
* number. The return value is false
* @tc.desc Function test
*/
it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1400', 0, async function (done) {
call.isEmergencyPhoneNumber('110', (err) => {
if (err) {
console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 finish err = ${err}`);
done();
return;
}
expect().assertFail();
console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 fail ');
done();
});
});
/**
* @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400
* @tc.name PhoneNumber: 120, no options. Call isEmergencyPhoneNumber() to check whether it is an emergency
* number. The return value is false
* @tc.desc Function test
*/
it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400', 0, async function (done) {
try {
var data = await call.isEmergencyPhoneNumber('120');
expect().assertFail();
console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 fail ');
done();
} catch (err) {
console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 finish err = ${err}`);
done();
}
});
});
\ No newline at end of file
......@@ -73,7 +73,40 @@ export default function smsUiJsunit() {
});
});
/*
* @tc.number Telephony_SmsMms_createMessage_Promise_0100
* @tc.name Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty
* @tc.desc Function test
*/
it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp').then(shortMessage => {
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue();
expect(shortMessage.status === 0).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Promise_0100 finish');
done();
}).catch(err => {
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0100 fail');
done();
return;
});
});
/*
......
......@@ -511,4 +511,44 @@ describe('SimManagerTest', function () {
}
done();
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotld_Async_0400
* @tc.name Test getDefaultVoiceSlotld interface,
* check the callback result
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotld_Async_0400', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotld_Async_0400';
sim.getDefaultVoiceSlotld((error, result) => {
if (error) {
console.log(`${CASE_NAME} getDefaultVoiceSlotld error: ${error.message}`);
expect().assertFail();
done();
return;
}
expect(result).assertFalse();
console.log(`${CASE_NAME} test finish.`);
done();
});
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotld_Promise_0400
* @tc.name Test getDefaultVoiceSlotld interface,
* check the returned result
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotld_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotld_Promise_0400';
try {
const result = await sim.getDefaultVoiceSlotld();
expect(result).assertFalse();
console.log(`${CASE_NAME} test finish.`);
} catch (error) {
console.log(`${CASE_NAME} getDefaultVoiceSlotld error: ${error.message}`);
expect().assertFail();
}
done();
});
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册