diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets index 33c3ebb6737822bde56c38d6b7b122879d979a92..72f6381d89b84ff983db445a544e80c51ad716e2 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets @@ -158,6 +158,21 @@ export default function dataJsunit() { console.log(`==========> ${caseName} Test end ==========>`); done(); }); + + /** + * @tc.number Telephony_Data_DefaultCellularDataSimId_DATA_GET_SimId + * @tc.name Enum DataConnectState + * @tc.desc Enum value test + */ + it("Telephony_Data_DefaultCellularDataSimId_DATA_GET_SimId", 0, async function (done) { + let caseName = 'Telephony_Data_DefaultCellularDataSimId_DATA_GET_SimId'; + console.log(`==========> ${caseName} Test start ==========>`); + console.log("Result: "+ data.getDefaultCellularDataSimId()); + expect(true).assertTrue(); + console.log(`==========> ${caseName} Test end ==========>`); + done(); + }); + }); } 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 d873be9746aec356d376e2a9c63427df8646b0c3..122835ce1d368a6c7e7ecf95a02e1cada66e9d91 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 @@ -14,6 +14,7 @@ */ import { describe, expect, it } from '@ohos/hypium'; import sms from '@ohos.telephony.sms'; +import radio from '@ohos.telephony.radio'; export default function smsUiJsunit() { describe('smsUiJsunit', function () { @@ -120,5 +121,51 @@ export default function smsUiJsunit() { expect(sms.ShortMessageClass.FORWARD_MESSAGE == 4).assertTrue(); 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(); + } + }); + 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 => { + 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(); + } + }); + done(); + }); + }); }) } diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js index b9391aec2257205101f8ee08d1bfffcadf5c419d..a4afa9ed96143f1492ca7df8e31a7defa270bf4b 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/js/test/SimManager.test.js @@ -14,6 +14,7 @@ */ import sim from '@ohos.telephony.sim'; +import radio from '@ohos.telephony.radio'; import * as env from './lib/Const'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function SimManagerTest() { @@ -496,5 +497,144 @@ describe('SimManagerTest', function () { done(); }); }); + /** + * @tc.number Telephony_Sim_getSimAccountInfo_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getSimAccountInfo_CallBack_0100', 0, async function (done) { + sim.getSimAccountInfo(0, (err, data) => { + if(err){ + console.info("Telephony_Sim_getSimAccountInfo_CallBack_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getSimAccountInfo_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sim_getSimAccountInfo_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getSimAccountInfo_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getSimAccountInfo_Promise_0100', 0, async function (done) { + let promise = sim.getSimAccountInfo(0); + promise.then(data => { + console.info("Telephony_Sim_getSimAccountInfo_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sim_getSimAccountInfo_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getSimAccountInfo_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100', 0, async function (done) { + sim.getActiveSimAccountInfoList((err, data) => { + if(err){ + console.info("Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sim_getActiveSimAccountInfoList_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getActiveSimAccountInfoList_Promise_0100', 0, async function (done) { + let promise = sim.getActiveSimAccountInfoList(); + promise.then(data => { + console.info("Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getActiveSimAccountInfoList_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getDefaultVoiceSimId_CallBack_0100', 0, async function (done) { + sim.getDefaultVoiceSimId((err, data) => { + if(err){ + console.info("Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + return; + } + console.log(`Telephony_Sim_getDefaultVoiceSimId_CallBack_0100 callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); + expect(true).assertTrue(); + done(); + }); + }); + /** + * @tc.number Telephony_Sim_getDefaultVoiceSimId_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc + */ + it('Telephony_Sim_getDefaultVoiceSimId_Promise_0100', 0, async function (done) { + let promise = sim.getDefaultVoiceSimId(); + promise.then(data => { + console.info("Telephony_Sim_getDefaultVoiceSimId_Promise_0100 data = " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info("Telephony_Sim_getDefaultVoiceSimId_Promise_0100 err = " + JSON.stringify(err)); + radio.isRadioOn(0, (err, data) => { + console.info('Telephony_Sim_getDefaultVoiceSimId_Promise_0100 isRadioOn err' + JSON.stringify(err) + ' data ' + JSON.stringify(data)); + if (!err) { + expect().assertFail(); + } + }); + done(); + }); + }); + + + }) }