From 04ed55eb158e1a239cf71a9ecd4964ca4f3f935c Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 16 Sep 2022 17:29:07 +0800 Subject: [PATCH] update Signed-off-by: lihao --- .../src/main/js/test/SimManager.test.js | 87 +++++++++++++++++-- 1 file changed, 79 insertions(+), 8 deletions(-) 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 6d8a34bf3..5a3ac37ce 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 @@ -287,7 +287,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700'; sim.isSimActive(env.SLOTID2, (err, data) => { console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data)); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); }); }); @@ -307,7 +307,7 @@ describe('SimManagerTest', function () { done(); }).catch(err => { console.info("isSimActive promise err info :" + JSON.stringify(err)); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); }); }); @@ -322,7 +322,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600'; sim.hasSimCard(env.SLOTID2, (err, data) => { if (err) { - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -342,7 +342,7 @@ describe('SimManagerTest', function () { try { let data = await sim.hasSimCard(env.SLOTID2); } catch (err) { - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -374,7 +374,7 @@ describe('SimManagerTest', function () { sim.getCardType(env.SLOTID2, (err, cardType) => { if (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -395,7 +395,7 @@ describe('SimManagerTest', function () { console.info(`${CASE_NAME} test finish.`); } catch (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); } done(); }); @@ -411,7 +411,7 @@ describe('SimManagerTest', function () { sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => { if (error) { console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); - expect().assertFail(); + expect(error.code).assertEqual(202); done(); return; } @@ -435,10 +435,81 @@ describe('SimManagerTest', function () { console.info(`${CASE_NAME} test finish.`); } catch (error) { console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); - expect().assertFail(); + expect(error.code).assertEqual(202); } done(); }); + /** + * @tc.number Telephony_Sim_getOpKey_CallBack_0100 + * @tc.name Test getOpKey interface + * @tc.desc Obtains the opkey of the SIM card in a specified slot.Returns the opkey; + * returns "-1" if no SIM card is inserted or no opkey matched. + */ + it('Telephony_Sim_getOpKey_CallBack_0100', 0, async function (done) { + sim.getOpKey(0, (err, data) => { + console.info("Telephony_Sim_getOpKey_CallBack_0100 err = " + JSON.stringify(err) + " data = " + JSON.stringify(data)); + if(err){ + expect(err.code).assertEqual(-1); + done(); + return; + } + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getOpKey_Promise_0100 + * @tc.name Test getOpKey interface + * @tc.desc Obtains the opkey of the SIM card in a specified slot.Returns the opkey; + * returns "-1" if no SIM card is inserted or no opkey matched. + */ + it('Telephony_Sim_getOpKey_Promise_0100', 0, async function (done) { + let promise = sim.getOpKey(0); + promise.then(data => { + console.info("Telephony_Sim_getOpKey_Promise_0100 data = " + JSON.stringify(data)); + done(); + }).catch(err => { + console.info("Telephony_Sim_getOpKey_Promise_0100 err = " + JSON.stringify(err)); + expect(err.code).assertEqual(-1); + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getOpName_CallBack_0100 + * @tc.name Test getOpName interface + * @tc.desc Obtains the opname of the SIM card in a specified slot. + * returns null if no SIM card is inserted or no opname matched. + */ + it('Telephony_Sim_getOpName_CallBack_0100', 0, async function (done) { + sim.getOpName(0, (err, data) => { + console.info("Telephony_Sim_getOpName_CallBack_0100 err = " + JSON.stringify(err) + " data = " + JSON.stringify(data)); + if(err){ + expect(err.code).assertEqual(-1); + done(); + return; + } + done(); + }); + }); + + /** + * @tc.number Telephony_Sim_getOpName_Promise_0100 + * @tc.name Test getOpName interface + * @tc.desc Obtains the opname of the SIM card in a specified slot. + * returns null if no SIM card is inserted or no opname matched. + */ + it('Telephony_Sim_getOpName_Promise_0100', 0, async function (done) { + let promise = sim.getOpName(0); + promise.then(data => { + console.info("Telephony_Sim_getOpName_Promise_0100 data = " + JSON.stringify(data)); + done(); + }).catch(err => { + console.info("Telephony_Sim_getOpName_Promise_0100 err = " + JSON.stringify(err)); + expect(err.code).assertEqual(-1); + done(); + }); + }); }) } -- GitLab