From a979bf3645d4df877cb973a8ea98ee66da8c6630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=AC=A2=E6=AC=A2?= Date: Thu, 20 Jul 2023 08:17:32 +0000 Subject: [PATCH] update SmsMmsJsunit.test.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 姜欢欢 --- .../src/main/ets/test/SmsMmsJsunit.test.ets | 75 +++++++++---------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets index 122835ce1..a0c97f827 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets @@ -15,6 +15,7 @@ import { describe, expect, it } from '@ohos/hypium'; import sms from '@ohos.telephony.sms'; import radio from '@ohos.telephony.radio'; +import sim from '@ohos.telephony.sim'; export default function smsUiJsunit() { describe('smsUiJsunit', function () { @@ -122,50 +123,46 @@ export default function smsUiJsunit() { done(); }); - /** - * @tc.number Telephony_Sms_getDefaultSmsSimId_CallBack_0100 - * @tc.name Test getOpName interface - * @tc.desc - */ - it('Telephony_Sms_getDefaultSmsSimId_CallBack_0100', 0, async function (done) { - sms.getDefaultSmsSimId((err, data) => { - if(err){ - console.info("Telephony_Sms_getDefaultSmsSimId_CallBack_0100 err = " + JSON.stringify(data)); - radio.isRadioOn(0, (err, data) => { - console.info('Telephony_Sms_getDefaultSmsSimId_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); - if (!err) { - expect().assertFail(); - } + /** + * @tc.number Telephony_Sms_getDefaultSmsSimId_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sms_getDefaultSmsSimId_CallBack_0100', 0, async function (done) { + sms.getDefaultSmsSimId((err, data) => { + if(err){ + console.info("Telephony_Sms_getDefaultSmsSimId_CallBack_0100 err = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + return; + } + console.log(`Telephony_Sms_getDefaultSmsSimId_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + sim.hasSimCard(0, (err, data) => { + console.log(`Telephony_Sms_getDefaultSmsSimId_CallBack_0100 hasSimCard callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(data).assertTrue(); + done(); }); - done(); - return; - } - console.log(`Telephony_Sms_getDefaultSmsSimId_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); - expect(true).assertTrue(); - done(); + }); }); - }); - /** - * @tc.number Telephony_Sms_getDefaultSmsSimId_Promise_0100 - * @tc.name Test getOpName interface - * @tc.desc - */ - it('Telephony_Sms_getDefaultSmsSimId_Promise_0100', 0, async function (done) { - let promise = sms.getDefaultSmsSimId(); - promise.then(data => { + /** + * @tc.number Telephony_Sms_getDefaultSmsSimId_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sms_getDefaultSmsSimId_Promise_0100', 0, async function (done) { + let promise = sms.getDefaultSmsSimId(); + promise.then(data => { console.info("Telephony_Sms_getDefaultSmsSimId_Promise_0100 data = " + JSON.stringify(data)); - expect(true).assertTrue(); - done(); - }).catch(err => { - console.info("Telephony_Sms_getDefaultSmsSimId_Promise_0100 err = " + JSON.stringify(err)); - radio.isRadioOn(0, (err, data) => { - console.info('Telephony_Sms_getDefaultSmsSimId_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); - if (!err) { - expect().assertFail(); - } + sim.hasSimCard(0, (err, data) => { + console.log(`Telephony_Sms_getDefaultSmsSimId_Promise_0100 hasSimCard callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(data).assertTrue(); + done(); }); + }).catch(err => { + console.info("Telephony_Sms_getDefaultSmsSimId_Promise_0100 err = " + JSON.stringify(err)); + expect(true).assertTrue(); done(); + }); }); - }); }) } -- GitLab