diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js index 6e794989c2ca4e557193334a935d34d3396c8d1a..33ae9ad45dd830bbda7e3a14604bfa235b04e97a 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js @@ -1,5 +1,5 @@ /** - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 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 @@ -14,7 +14,7 @@ */ import network from '@system.network'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; export default function Telephony_NetManager_NetWorkTest() { describe("Telephony_NetManager_NetWorkTest", function () { @@ -31,13 +31,13 @@ describe("Telephony_NetManager_NetWorkTest", function () { done(); }, fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code == 602).assertTrue() + console.info("NetManager code "+ code); + expect(code == 201).assertTrue(); done(); }, complete : function(){ } - }) + }); }); /** @@ -48,17 +48,17 @@ describe("Telephony_NetManager_NetWorkTest", function () { it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) { network.getType({ success : function(data){ - expect().assertFail() + expect().assertFail(); done(); }, fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code == 602).assertTrue() + console.info("NetManager code "+ code); + expect(code == 201).assertTrue(); done(); }, complete : function(){ } - }) + }); }); /** @@ -69,16 +69,16 @@ describe("Telephony_NetManager_NetWorkTest", function () { it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) { network.subscribe({ success : function(data){ - expect().assertFail() + expect().assertFail(); done(); }, fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code == 602).assertTrue() + console.info("NetManager code "+ code); + expect(code == 201).assertTrue(); done(); } - }) - }) + }); + }); /** * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200 @@ -88,16 +88,16 @@ describe("Telephony_NetManager_NetWorkTest", function () { it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) { network.subscribe({ success : function(data){ - expect().assertFail() + expect().assertFail(); done(); }, fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code == 602).assertTrue() + console.info("NetManager code "+ code); + expect(code == 201).assertTrue(); 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 84032d34c9ee1fd82c9d88ef9f008f9cb521e52a..0d3e63b8a89ee60c96534d93de4d16611058c955 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2023 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 @@ -268,7 +268,6 @@ describe('SimManagerTest', function () { * @tc.desc Function test */ it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) { - 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); @@ -283,7 +282,6 @@ describe('SimManagerTest', function () { * @tc.desc Function test */ it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) { - const CASE_NAME = 'Telephony_Sim_isSimActive_Promise_0700'; let promise = sim.isSimActive(env.SLOTID2); promise.then(data => { console.log(`isSimActive success, promise: data->${JSON.stringify(data)}`); @@ -306,12 +304,12 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600'; sim.hasSimCard(env.SLOTID2, (err, data) => { if (err) { - expect(err.code).assertEqual(202); - console.info(`${CASE_NAME} fail, err: ${err.message}`); + expect(err.code).assertEqual(8300001); + console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err)); done(); return; } - console.info(`${CASE_NAME} finish`); + console.info(CASE_NAME + ' finish' + JSON.stringify(data)); }); }); @@ -326,12 +324,12 @@ describe('SimManagerTest', function () { try { let data = await sim.hasSimCard(env.SLOTID2); } catch (err) { - expect(err.code).assertEqual(202); - console.info(`${CASE_NAME} fail, err: ${err.message}`); + expect(err.code).assertEqual(8300001); + console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err)); done(); return; } - console.info(`${CASE_NAME} finish`); + console.info(CASE_NAME + ' finish'); }); /** @@ -357,12 +355,14 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_GetCardType_Async_0400'; sim.getCardType(env.SLOTID2, (err, cardType) => { if (err) { - console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual(202); + console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err)); + expect(err.code).assertEqual(8300001); done(); return; } - console.info(`${CASE_NAME} test finish.`); + console.info(CASE_NAME + ' finish' + JSON.stringify(cardType)); + expect().assertFail(); + done(); }); }); @@ -376,10 +376,10 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_GetCardType_Promise_0400'; try { const cardType = await sim.getCardType(env.SLOTID2); - console.info(`${CASE_NAME} test finish.`); + console.info(CASE_NAME + ' finish'); } catch (err) { - console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual(202); + console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err)); + expect(err.code).assertEqual(8300001); } done(); }); @@ -394,13 +394,13 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Async_0400'; sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => { if (error) { - console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); - expect(error.code).assertEqual(202); + console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error)); + expect(error.code).assertEqual(8300001); done(); return; } - expect(result).assertFalse(); - console.info(`${CASE_NAME} test finish.`); + console.info(CASE_NAME + ' finish' + JSON.stringify(result)); + expect().assertFail(); done(); }); }); @@ -415,11 +415,12 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Promise_0400'; try { const result = await sim.hasOperatorPrivileges(env.SLOTID2); - expect(result).assertFalse(); - console.info(`${CASE_NAME} test finish.`); + console.info(CASE_NAME + ' finish' + JSON.stringify(result)); + expect().assertFail(); + done(); } catch (error) { - console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); - expect(error.code).assertEqual(202); + console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error)); + expect(error.code).assertEqual(8300001); } done(); }); diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js index 89cef842b72b216698282b888c743eada462531f..6f1afa265dcced7aed155f674b88120edca84388 100644 --- a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js @@ -677,17 +677,17 @@ export default function ActsBaseCallManagerTest() { * @tc.desc Function test */ it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200', 0, async function (done) { + let CASE_NAME = 'Telephony_CallManager_isEmergencyPhoneNumber_Async_0200'; call.isEmergencyPhoneNumber(INVALID_NUMBER, { slotId: SLOT_0 }, (err, data) => { if (err) { - console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 fail'); - expect().assertFail(); + console.log(CASE_NAME + ' fail' + JSON.stringify(err)); + expect(err.code).assertEqual(8300001); done(); return; } - expect(data === false).assertTrue(); - console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 finish data = ${data}`); + console.log(CASE_NAME +' finish data = '+ JSON.stringify(data)); done(); }); });