提交 809d9e81 编写于 作者: Z zhangfuzhi

电话新增用例

Signed-off-by: Nzhangfuzhi <zhangfuzhi1@huawei.com>
上级 2011b793
......@@ -1294,6 +1294,77 @@ export default function connectionJsunit() {
done();
});
/*
* @tc.number : Telephony_Connection_setAppNet_callback_0100
* @tc.name : Telephony_Connection_setAppNet_callback_0100
* @tc.desc : Telephony_Connection_setAppNet_callback_0100
*/
it('Telephony_Connection_setAppNet_callback_0100', 0, function (done) {
connection.getDefaultNet(function (error, netHandle) {
if (error) {
console.log("getDefaultNet error " + JSON.stringify(error));
expect(true).assertFalse();
done();
return;
}
console.log("getDefaultNet success " + JSON.stringify(netHandle));
connection.setAppNet(netHandle, (error, data) => {
if (error) {
console.log("setAppNet error " + JSON.stringify(error));
expect(true).assertFalse();
done();
return;
}
console.log("setAppNet success " + JSON.stringify(data));
connection.getAppNet(function (error, data) {
if (error) {
console.log("getAppNet error " + JSON.stringify(error));
expect(true).assertFalse();
done();
return;
}
console.log("getAppNet success " + JSON.stringify(data));
expect(netHandle.netId == data.netId).assertTrue();
done();
})
});
})
});
/*
* @tc.number : Telephony_Connection_setAppNet_promise_0100
* @tc.name : Telephony_Connection_setAppNet_promise_0100
* @tc.desc : Telephony_Connection_setAppNet_promise_0100
*/
it('Telephony_Connection_setAppNet_promise_0100', 0, function (done) {
connection.getDefaultNet(function (error, netHandle) {
if (error) {
console.log("getDefaultNet error " + JSON.stringify(error));
expect(true).assertFalse();
done();
return;
}
console.log("getDefaultNet success " + JSON.stringify(netHandle));
connection.setAppNet(netHandle).then((data) => {
console.log("setAppNet success " + JSON.stringify(data));
connection.getAppNet().then((data) => {
console.log("getAppNet success " + JSON.stringify(data));
expect(netHandle.netId == data.netId).assertTrue();
done();
}).catch(error => {
console.log("getAppNet error " + JSON.stringify(error));
expect(true).assertFalse();
done();
})
}).catch(error => {
console.log("setAppNet error " + JSON.stringify(error));
expect(true).assertFalse();
done();
})
})
});
console.log("************* connection Test end*************");
})
}
......@@ -30,7 +30,7 @@ let options = {
key: "key",
cert: "cert",
ca: ["ca"],
passwd: "123456",
password: "123456",
protocols: [socket.Protocol.TLSv12, socket.Protocol.TLSv13],
useRemoteCipherPrefer: true,
signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256",
......@@ -82,7 +82,7 @@ export default function networkManagerSocketTest() {
expect(options.secureOptions.key != undefined).assertEqual(true);
expect(options.secureOptions.cert != undefined).assertEqual(true);
expect(options.secureOptions.ca != undefined).assertEqual(true);
expect(options.secureOptions.passwd != undefined).assertEqual(true);
expect(options.secureOptions.password != undefined).assertEqual(true);
expect(options.secureOptions.protocols != undefined).assertEqual(true);
expect(options.secureOptions.protocols[0] == "TLSv1.2").assertEqual(true);
expect(options.secureOptions.protocols[1] == "TLSv1.3").assertEqual(true);
......
......@@ -18,511 +18,512 @@ import observer from '@ohos.telephony.observer';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function ActsNetworkSearchTest() {
describe('ActsNetworkSearchTest', function () {
describe('ActsNetworkSearchTest', function () {
const SLOT_0 = 0;
const SLOT_2 = -1;
function sleep(timeout) {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.info(`Telephony_NetworkSearch_CellInformation sleep ${timeout}ms`);
resolve();
}, timeout);
})
}
const SLOT_0 = 0;
const SLOT_2 = -1;
async function turnOnRadio() {
let isOn = await radio.isRadioOn();
if (!isOn) {
await radio.turnOnRadio();
console.info('Telephony_NetworkSearch_CellInformation turnOnRadio success');
await sleep(5000);
}
}
function sleep(timeout) {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.info(`Telephony_NetworkSearch_CellInformation sleep ${timeout}ms`);
resolve();
}, timeout);
beforeAll(async function () {
await radio.setPreferredNetwork(SLOT_0, radio.PREFERRED_NETWORK_MODE_AUTO);
await turnOnRadio();
})
}
async function turnOnRadio() {
let isOn = await radio.isRadioOn();
if (!isOn) {
await radio.turnOnRadio();
console.info('Telephony_NetworkSearch_CellInformation turnOnRadio success');
await sleep(5000);
}
}
beforeAll(async function () {
await radio.setPreferredNetwork(SLOT_0, radio.PREFERRED_NETWORK_MODE_AUTO);
await turnOnRadio();
})
afterAll(async function () {
await radio.setPreferredNetwork(SLOT_0, radio.PREFERRED_NETWORK_MODE_AUTO);
await turnOnRadio();
})
afterEach(async function () {
try {
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN === 0).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_1XRTT === 2).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_WCDMA === 3).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_HSPA === 4).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_HSPAP === 5).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_TD_SCDMA === 6).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_EVDO === 7).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_EHRPD === 8).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_LTE === 9).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_LTE_CA === 10).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_IWLAN === 11).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_NR === 12).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_UNKNOWN === 0).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_GSM === 1).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_CDMA === 2).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_WCDMA === 3).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_TDSCDMA === 4).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_LTE === 5).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_NR === 6).assertTrue();
expect(radio.RegState.REG_STATE_NO_SERVICE === 0).assertTrue();
expect(radio.RegState.REG_STATE_IN_SERVICE === 1).assertTrue();
expect(radio.RegState.REG_STATE_EMERGENCY_CALL_ONLY === 2).assertTrue();
expect(radio.RegState.REG_STATE_POWER_OFF === 3).assertTrue();
expect(radio.NsaState.NSA_STATE_NOT_SUPPORT === 1).assertTrue();
expect(radio.NsaState.NSA_STATE_NO_DETECT === 2).assertTrue();
expect(radio.NsaState.NSA_STATE_CONNECTED_DETECT === 3).assertTrue();
expect(radio.NsaState.NSA_STATE_IDLE_DETECT === 4).assertTrue();
expect(radio.NsaState.NSA_STATE_DUAL_CONNECTED === 5).assertTrue();
expect(radio.NsaState.NSA_STATE_SA_ATTACHED === 6).assertTrue();
expect(radio.NetworkSelectionMode.NETWORK_SELECTION_UNKNOWN === 0).assertTrue();
expect(radio.NetworkSelectionMode.NETWORK_SELECTION_MANUAL === 2).assertTrue();
} catch (error) {
console.info(`Telephony_NetworkSearch error`);
}
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Async_0700
* @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkState_Async_0700', 0, async function (done) {
radio.getNetworkState(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getNetworkState_Async_0700 finish err: ${err}`);
done();
return;
afterAll(async function () {
await radio.setPreferredNetwork(SLOT_0, radio.PREFERRED_NETWORK_MODE_AUTO);
await turnOnRadio();
})
afterEach(async function () {
try {
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN === 0).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_1XRTT === 2).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_WCDMA === 3).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_HSPA === 4).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_HSPAP === 5).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_TD_SCDMA === 6).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_EVDO === 7).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_EHRPD === 8).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_LTE === 9).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_LTE_CA === 10).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_IWLAN === 11).assertTrue();
expect(radio.RadioTechnology.RADIO_TECHNOLOGY_NR === 12).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_UNKNOWN === 0).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_GSM === 1).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_CDMA === 2).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_WCDMA === 3).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_TDSCDMA === 4).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_LTE === 5).assertTrue();
expect(radio.NetworkType.NETWORK_TYPE_NR === 6).assertTrue();
expect(radio.RegState.REG_STATE_NO_SERVICE === 0).assertTrue();
expect(radio.RegState.REG_STATE_IN_SERVICE === 1).assertTrue();
expect(radio.RegState.REG_STATE_EMERGENCY_CALL_ONLY === 2).assertTrue();
expect(radio.RegState.REG_STATE_POWER_OFF === 3).assertTrue();
expect(radio.NsaState.NSA_STATE_NOT_SUPPORT === 1).assertTrue();
expect(radio.NsaState.NSA_STATE_NO_DETECT === 2).assertTrue();
expect(radio.NsaState.NSA_STATE_CONNECTED_DETECT === 3).assertTrue();
expect(radio.NsaState.NSA_STATE_IDLE_DETECT === 4).assertTrue();
expect(radio.NsaState.NSA_STATE_DUAL_CONNECTED === 5).assertTrue();
expect(radio.NsaState.NSA_STATE_SA_ATTACHED === 6).assertTrue();
expect(radio.NetworkSelectionMode.NETWORK_SELECTION_UNKNOWN === 0).assertTrue();
expect(radio.NetworkSelectionMode.NETWORK_SELECTION_MANUAL === 2).assertTrue();
} catch (error) {
console.info(`Telephony_NetworkSearch error`);
}
console.info(`Telephony_NetworkSearch_getNetworkState_Async_0700 fail not go to err ${data}`);
expect(data.longOperatorName != 'longOperatorName').assertTrue();
expect(data.shortOperatorName != 'shortOperatorName').assertTrue();
expect(data.plmnNumeric != 'plmnNumeric').assertTrue();
expect(data.isRoaming != true).assertTrue();
expect(data.regState != radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState != radio.NSA_STATE_SA_ATTACHED).assertTrue();
expect(data.isCaActive != true).assertTrue();
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0400
* @tc.name SlotId parameter input is -1, test getRadioTech() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getRadioTech_Async_0400', 0, async function (done) {
radio.getRadioTech(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getRadioTech_Async_0400 finish err: ${err}`);
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Async_0700
* @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkState_Async_0700', 0, async function (done) {
radio.getNetworkState(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getNetworkState_Async_0700 finish err: ${err}`);
done();
return;
}
console.info(`Telephony_NetworkSearch_getNetworkState_Async_0700 fail not go to err ${data}`);
expect(data.longOperatorName != 'longOperatorName').assertTrue();
expect(data.shortOperatorName != 'shortOperatorName').assertTrue();
expect(data.plmnNumeric != 'plmnNumeric').assertTrue();
expect(data.isRoaming != true).assertTrue();
expect(data.regState != radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState != radio.NSA_STATE_SA_ATTACHED).assertTrue();
expect(data.isCaActive != true).assertTrue();
expect().assertFail();
done();
return;
}
console.info(`Telephony_NetworkSearch_getRadioTech_Async_0400 fail not go to err ${data}`);
expect().assertFail();
done();
});
});
});
/**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0400
* @tc.name SlotId parameter input is -1, test getSignalInformation() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getSignalInformation_Async_0400', 0, async function (done) {
radio.getSignalInformation(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getSignalInformation_Async_0400 fail err: ${err}`);
expect(err.code).assertEqual(202);
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0400
* @tc.name SlotId parameter input is -1, test getRadioTech() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getRadioTech_Async_0400', 0, async function (done) {
radio.getRadioTech(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getRadioTech_Async_0400 finish err: ${err}`);
done();
return;
}
console.info(`Telephony_NetworkSearch_getRadioTech_Async_0400 fail not go to err ${data}`);
expect().assertFail();
done();
return;
}
console.info(`getSignalInformation_Async_0400 data: ${JSON.stringify(data)}`);
if (data.length > 0) {
expect(data[0].signalLevel != -1).assertTrue();
expect(data[0].signalType != radio.NETWORK_TYPE_WCDMA).assertTrue();
}
expect(data.length === 0).assertTrue();
done();
});
});
});
/**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400
* @tc.name SlotId parameter input is -1, test getISOCountryCodeForNetwork() query function and datalengtch = 0
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400', 0, async function (done) {
radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err: ${err}`);
expect(err.code).assertEqual(202);
/**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0400
* @tc.name SlotId parameter input is -1, test getSignalInformation() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getSignalInformation_Async_0400', 0, async function (done) {
radio.getSignalInformation(SLOT_2, (err, data) => {
if (err) {
console.info('Telephony_NetworkSearch_getSignalInformation_Async_0400 fail err:' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
console.info('getSignalInformation_Async_0400 data: ' + JSON.stringify(data));
if (data.length > 0) {
expect(data[0].signalLevel != -1).assertTrue();
expect(data[0].signalType != radio.NETWORK_TYPE_WCDMA).assertTrue();
}
expect(data.length === 0).assertTrue();
done();
return;
}
console.info(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 finish data: ${JSON.stringify(data)}`);
expect(data.length === 0).assertTrue();
done();
});
});
});
/**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400
* @tc.name SlotId parameter input is -1, test getISOCountryCodeForNetwork() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400', 0, async function (done) {
try {
let data = await radio.getISOCountryCodeForNetwork(SLOT_2);
console.info(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 finish data:${JSON.stringify(data)}`);
expect(data.length === 0).assertTrue();
done();
} catch (err) {
console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`);
expect(err.code).assertEqual(202);
done();
return;
}
});
/**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400
* @tc.name SlotId parameter input is -1, test getISOCountryCodeForNetwork() query function and datalengtch = 0
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400', 0, async function (done) {
radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => {
if (err) {
console.info('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err:' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
console.info(
'Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 finish data: ' + JSON.stringify(data));
expect(data.length === 0).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500
* @tc.name SlotId parameter input is -1, test getNetworkSelectionMode() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500', 0, async function (done) {
radio.getNetworkSelectionMode(SLOT_2, (err, res) => {
if (err) {
console.info(`Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500 err: ${err}`);
/**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400
* @tc.name SlotId parameter input is -1, test getISOCountryCodeForNetwork() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400', 0, async function (done) {
try {
let data = await radio.getISOCountryCodeForNetwork(SLOT_2);
console.info(
'Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 finish data:' + JSON.stringify(data));
expect(data.length === 0).assertTrue();
done();
} else {
console.info('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500 fail not go to err');
expect().assertFail();
} catch (err) {
console.info('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err:' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500
* @tc.name SlotId parameter input is -1, test getNetworkSelectionMode() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500', 0, async function (done) {
radio.getNetworkSelectionMode(SLOT_2, (err, res) => {
if (err) {
console.info(`Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500 err: ${err}`);
done();
} else {
console.info('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0500 fail not go to err');
expect().assertFail();
done();
}
});
});
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500
* @tc.name SlotId parameter input is -1, test getNetworkSelectionMode() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500', 0, async function (done) {
try {
await radio.getNetworkSelectionMode(SLOT_2);
console.info('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500 fail not go to err');
expect().assertFail();
} catch (err) {
console.info('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500 finish');
/**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500
* @tc.name SlotId parameter input is -1, test getNetworkSelectionMode() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500', 0, async function (done) {
try {
await radio.getNetworkSelectionMode(SLOT_2);
console.info('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500 fail not go to err');
expect().assertFail();
} catch (err) {
console.info('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0500 finish');
done();
return;
}
done();
return;
}
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Promise_0700
* @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkState_Promise_0700', 0, async function (done) {
try {
await radio.getNetworkState(SLOT_2);
console.info('Telephony_NetworkSearch_getNetworkState_Promise_0700 fail not go to err');
expect().assertFail();
} catch (err) {
console.info(`Telephony_NetworkSearch_getNetworkState_Promise_0700 finish err: ${err}`);
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0400
* @tc.name SlotId parameter input is -1, test getRadioTech() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getRadioTech_Promise_0400', 0, async function (done) {
try {
await radio.getRadioTech(SLOT_2);
console.info('Telephony_NetworkSearch_getRadioTech_Promise_0400 fail not go to err');
expect().assertFail();
} catch (err) {
console.info(`Telephony_NetworkSearch_getRadioTech_Promise_0400 finish err: ${err}`);
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Promise_0400
* @tc.name SlotId parameter input is -1, test getSignalInformation() query function return the datalength is 0
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getSignalInformation_Promise_0400', 0, async function (done) {
try {
let data = await radio.getSignalInformation(SLOT_2);
console.info(
`Telephony_NetworkSearch_getSignalInformation_Promise_0400 finish data: ${JSON.stringify(data)}`);
expect(data.length === 0).assertTrue();
} catch (err) {
console.info(`Telephony_NetworkSearch_getSignalInformation_Promise_0400 fail err: ${err}`);
expect(err.code).assertEqual(202);
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0400
* @tc.name Verify the abnormal input of "slotId", test getOperatorName() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getOperatorName_Async_0400', 0, async function (done) {
radio.getOperatorName(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getOperatorName_Async_0400 fail err: ${err}`);
expect(err.code).assertEqual(202);
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Promise_0700
* @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getNetworkState_Promise_0700', 0, async function (done) {
try {
await radio.getNetworkState(SLOT_2);
console.info('Telephony_NetworkSearch_getNetworkState_Promise_0700 fail not go to err');
expect().assertFail();
} catch (err) {
console.info(`Telephony_NetworkSearch_getNetworkState_Promise_0700 finish err: ${err}`);
done();
return;
}
console.info(`Telephony_NetworkSearch_getOperatorName_Async_0400 finish data: ${data}`);
expect(data === '').assertTrue();
done();
})
})
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Promise_0400
* @tc.name Verify the abnormal input of "slotId", test getOperatorName() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getOperatorName_Promise_0400', 0, async function (done) {
try {
let data = await radio.getOperatorName(SLOT_2);
console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0400 finish data: ${data}`);
expect(data === '').assertTrue();
done();
} catch (err) {
console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0400 fail err: ${err}`);
expect(err.code).assertEqual(202);
done();
}
})
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0500
* @tc.name testGetOperatorName_0500
* @tc.desc Test getOperatorName api by callback.
*/
it('Telephony_NetworkSearch_getOperatorName_Async_0500', 0, async function (done) {
radio.getOperatorName(0, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getOperatorName_Async_0500 fail err: ${err}`);
});
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0400
* @tc.name SlotId parameter input is -1, test getRadioTech() query function go to the error
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getRadioTech_Promise_0400', 0, async function (done) {
try {
await radio.getRadioTech(SLOT_2);
console.info('Telephony_NetworkSearch_getRadioTech_Promise_0400 fail not go to err');
expect().assertFail();
} catch (err) {
console.info(`Telephony_NetworkSearch_getRadioTech_Promise_0400 finish err: ${err}`);
done();
return;
}
console.info(`Telephony_NetworkSearch_getOperatorName_Async_0500 finish data: ${data}`);
expect(true).assertTrue();
done();
})
})
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0600
* @tc.name testGetOperatorName_0600
* @tc.desc Test getOperatorName api by promise.
*/
it('Telephony_NetworkSearch_getOperatorName_Promise_0500', 0, async function (done) {
try {
let data = await radio.getOperatorName(0);
console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0500 finish data: ${data}`);
expect(true).assertTrue();
done();
} catch (err) {
console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0500 fail err: ${err}`);
expect().assertFail();
done();
}
})
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0200
* @tc.name Test The function isRadioOn
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isRadioOn_Async_0200', 0, async function (done) {
radio.isRadioOn((err, data) => {
if (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
});
/**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Promise_0400
* @tc.name SlotId parameter input is -1, test getSignalInformation() query function return the datalength is 0
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getSignalInformation_Promise_0400', 0, async function (done) {
try {
let data = await radio.getSignalInformation(SLOT_2);
console.info(
'Telephony_NetworkSearch_getSignalInformation_Promise_0400 finish data: ' + JSON.stringify(data));
expect(data.length === 0).assertTrue();
} catch (err) {
console.info('Telephony_NetworkSearch_getSignalInformation_Promise_0400 fail err: ' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
console.info('Telephony_NetworkSearch_isRadioOn_Async_0200 finish ' + JSON.stringify(data));
expect(data == true).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Promise_0200
* @tc.name Test The function isRadioOn
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isRadioOn_Promise_0200', 0, async function (done) {
try {
let data = await radio.isRadioOn();
console.info('Telephony_NetworkSearch_isRadioOn_Promise_0200 finish ' + JSON.stringify(data));
expect(data == true).assertTrue();
done();
} catch (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
done();
}
});
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0400
* @tc.name Verify the abnormal input of "slotId", test getOperatorName() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getOperatorName_Async_0400', 0, async function (done) {
radio.getOperatorName(SLOT_2, (err, data) => {
if (err) {
console.info('Telephony_NetworkSearch_getOperatorName_Async_0400 fail err:' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
console.info('Telephony_NetworkSearch_getOperatorName_Async_0400 finish data:' + data);
expect(data === '').assertTrue();
done();
})
})
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0300
* @tc.name testIsRadioOn_0300
* @tc.desc Test isRadioOn api by callback.
*/
it('Telephony_NetworkSearch_isRadioOn_Async_0300', 0, async function (done) {
radio.isRadioOn(0, (err, data) => {
if (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Promise_0400
* @tc.name Verify the abnormal input of "slotId", test getOperatorName() to view the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getOperatorName_Promise_0400', 0, async function (done) {
try {
let data = await radio.getOperatorName(SLOT_2);
console.info('Telephony_NetworkSearch_getOperatorName_Promise_0400 finish data: ' + data);
expect(data === '').assertTrue();
done();
} catch (err) {
console.info('Telephony_NetworkSearch_getOperatorName_Promise_0400 fail err: ' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
console.info('Telephony_NetworkSearch_isRadioOn_Async_0300 finish ' + JSON.stringify(data));
expect(data == true).assertTrue();
done();
});
});
})
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0400
* @tc.name testIsRadioOn_0400
* @tc.desc Test isRadioOn api by promise.
*/
it('Telephony_NetworkSearch_isRadioOn_Promise_0300', 0, async function (done) {
try {
let data = await radio.isRadioOn(0);
console.info('Telephony_NetworkSearch_isRadioOn_Promise_0300 finish ' + JSON.stringify(data));
expect(data == true).assertTrue();
done();
} catch (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
done();
}
});
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0500
* @tc.name testGetOperatorName_0500
* @tc.desc Test getOperatorName api by callback.
*/
it('Telephony_NetworkSearch_getOperatorName_Async_0500', 0, async function (done) {
radio.getOperatorName(0, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getOperatorName_Async_0500 fail err: ${err}`);
expect().assertFail();
done();
return;
}
console.info(`Telephony_NetworkSearch_getOperatorName_Async_0500 finish data: ${data}`);
expect(true).assertTrue();
done();
})
})
/**
* @tc.number Telephony_StateRegistry_on_0200
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_on_0200', 0, async function (done) {
try {
observer.on('networkStateChange', {
slotId: 0
}, NetworkState => {
console.log("on networkStateChange, NetworkState:" + JSON.stringify(NetworkState));
expect(typeof NetworkState === undefined).assertFalse();
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0600
* @tc.name testGetOperatorName_0600
* @tc.desc Test getOperatorName api by promise.
*/
it('Telephony_NetworkSearch_getOperatorName_Promise_0500', 0, async function (done) {
try {
let data = await radio.getOperatorName(0);
console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0500 finish data: ${data}`);
expect(true).assertTrue();
done();
} catch (err) {
console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0500 fail err: ${err}`);
expect().assertFail();
done();
}
})
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0200
* @tc.name Test The function isRadioOn
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isRadioOn_Async_0200', 0, async function (done) {
radio.isRadioOn((err, data) => {
if (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300000);
done();
return;
}
console.info('Telephony_NetworkSearch_isRadioOn_Async_0200 finish ' + JSON.stringify(data));
expect(data == true).assertTrue();
done();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_StateRegistry_off_0200
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_off_0200', 0, async function (done) {
try {
let callback = NetworkState => {
console.log("on networkStateChange, NetworkState:" + JSON.stringify(NetworkState));
expect(typeof NetworkState === undefined).assertFalse();
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Promise_0200
* @tc.name Test The function isRadioOn
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isRadioOn_Promise_0200', 0, async function (done) {
try {
await radio.isRadioOn();
done();
} catch (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300000);
done();
}
observer.on('networkStateChange', callback);
// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
observer.off('networkStateChange', callback);
observer.off('networkStateChange');
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_StateRegistry_on_0300
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_on_0300', 0, async function (done) {
try {
observer.on('signalInfoChange', {
slotId: 0
}, SignalInformation => {
console.log("on signalInfoChange, SignalInformation:" + JSON.stringify(SignalInformation));
expect(typeof SignalInformation === undefined).assertFalse();
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0300
* @tc.name testIsRadioOn_0300
* @tc.desc Test isRadioOn api by callback.
*/
it('Telephony_NetworkSearch_isRadioOn_Async_0300', 0, async function (done) {
radio.isRadioOn(0, (err,data) => {
if (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300000);
done();
return;
}
console.info('Telephony_NetworkSearch_isRadioOn_Async_0300 finish ' + data);
expect(data == true).assertTrue();
done();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_StateRegistry_off_0300
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_off_0300', 0, async function (done) {
try {
let callback = SignalInformation => {
console.log("on signalInfoChange, SignalInformation:" + JSON.stringify(SignalInformation));
expect(typeof SignalInformation === undefined).assertFalse();
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0400
* @tc.name testIsRadioOn_0400
* @tc.desc Test isRadioOn api by promise.
*/
it('Telephony_NetworkSearch_isRadioOn_Promise_0300', 0, async function (done) {
try {
let data = await radio.isRadioOn(0);
console.info('Telephony_NetworkSearch_isRadioOn_Promise_0300 finish ' + JSON.stringify(data));
done();
} catch (err) {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300000);
done();
}
observer.on('signalInfoChange', callback);
// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
observer.off('signalInfoChange', callback);
observer.off('signalInfoChange');
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_StateRegistry_on_0200
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_on_0200', 0, async function (done) {
try {
observer.on('networkStateChange', {
slotId: 0
}, NetworkState => {
console.log("on networkStateChange, NetworkState:" + JSON.stringify(NetworkState));
expect(typeof NetworkState === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number Telephony_StateRegistry_off_0200
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_off_0200', 0, async function (done) {
try {
let callback = NetworkState => {
console.log("on networkStateChange, NetworkState:" + JSON.stringify(NetworkState));
expect(typeof NetworkState === undefined).assertFalse();
}
observer.on('networkStateChange', callback);
// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
observer.off('networkStateChange', callback);
observer.off('networkStateChange');
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
/**
* @tc.number Telephony_StateRegistry_on_0300
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_on_0300', 0, async function (done) {
try {
observer.on('signalInfoChange', {
slotId: 0
}, SignalInformation => {
console.log("on signalInfoChange, SignalInformation:" + JSON.stringify(SignalInformation));
expect(typeof SignalInformation === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_StateRegistry_off_0300
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
* @tc.desc Function test
*/
it('Telephony_StateRegistry_off_0300', 0, async function (done) {
try {
let callback = SignalInformation => {
console.log("on signalInfoChange, SignalInformation:" + JSON.stringify(SignalInformation));
expect(typeof SignalInformation === undefined).assertFalse();
}
observer.on('signalInfoChange', callback);
// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
observer.off('signalInfoChange', callback);
observer.off('signalInfoChange');
done();
} catch (error) {
expect(false).assertTrue();
done();
}
});
});
}
......@@ -76,5 +76,26 @@ export default function radioJsunit() {
done();
}
});
/**
* @tc.number Telephony_NetworkSearch_isNRSupported_Async_0100
* @tc.name Test The function isNRSupported(soltId)
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isNRSupported_Async_0100', 0, async function (done) {
let CaseName = "Telephony_NetworkSearch_isNRSupported_Async_0100 ";
try {
let result = radio.isNRSupported();
console.info("Result: " + result);
let result0 = radio.isNRSupported(SLOT_0);
console.info("Result0: " + result0);
console.info(CaseName + "is complete!");
done();
} catch (err) {
console.info(CaseName + "err " + JSON.stringify(err));
expect(false).assertTrue();
done();
}
});
})
}
......@@ -315,6 +315,7 @@ export default function radioSecondJsunit() {
expect(data[i].timeStamp).assertLarger(0);
expect(NETWORK_TYPES).assertContain(data[i].signalInformation.signalType);
expect(NETWORK_SIGNAL).assertContain(data[i].signalInformation.signalLevel);
expect(NETWORK_SIGNAL).assertContain(data[i].signalInformation.dBm);
expect(data[i].data != undefined && data[i].data != '' && data[i].data != null).assertTrue();
if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_LTE) {
console.log("radio.NetworkType.NETWORK_TYPE_LTE:" + radio.NetworkType.NETWORK_TYPE_LTE);
......
......@@ -18,39 +18,39 @@ import * as env from './lib/Const';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function SimManagerTest() {
describe('SimManagerTest', function () {
afterEach(async function () {
try {
class IccAccountInfo {
constructor (slotIndex, showName, showNumber) {
this.slotIndex = slotIndex;
this.showName = showName;
this.showNumber = showNumber;
describe('SimManagerTest', function () {
afterEach(async function () {
try {
class IccAccountInfo {
constructor (slotIndex, showName, showNumber) {
this.slotIndex = slotIndex;
this.showName = showName;
this.showNumber = showNumber;
}
}
}
const SLOT_INDEX = 0;
const SHOW_NAME = 'test';
const SHOW_NUMBER = '10';
let iccAccountInfo = new IccAccountInfo(SLOT_INDEX, SHOW_NAME, SHOW_NUMBER);
expect(iccAccountInfo.slotIndex === SLOT_INDEX).assertTrue();
expect(iccAccountInfo.showName === SHOW_NAME).assertTrue();
expect(iccAccountInfo.showNumber === SHOW_NUMBER).assertTrue();
const SLOT_INDEX = 0;
const SHOW_NAME = 'test';
const SHOW_NUMBER = '10';
let iccAccountInfo = new IccAccountInfo(SLOT_INDEX, SHOW_NAME, SHOW_NUMBER);
expect(iccAccountInfo.slotIndex === SLOT_INDEX).assertTrue();
expect(iccAccountInfo.showName === SHOW_NAME).assertTrue();
expect(iccAccountInfo.showNumber === SHOW_NUMBER).assertTrue();
class LockStatusResponse {
constructor (result, remain) {
this.result = result;
this.remain = remain;
class LockStatusResponse {
constructor (result, remain) {
this.result = result;
this.remain = remain;
}
}
const RES_RESULT = 0;
const RES_REMAIN = 0;
let lockStatusResponse = new LockStatusResponse(RES_RESULT, RES_REMAIN);
expect(lockStatusResponse.result === RES_RESULT).assertTrue();
expect(lockStatusResponse.remain === RES_REMAIN).assertTrue();
} catch (error) {
console.info(`Telephony_Sim error`);
}
const RES_RESULT = 0;
const RES_REMAIN = 0;
let lockStatusResponse = new LockStatusResponse(RES_RESULT, RES_REMAIN);
expect(lockStatusResponse.result === RES_RESULT).assertTrue();
expect(lockStatusResponse.remain === RES_REMAIN).assertTrue();
} catch (error) {
console.info(`Telephony_Sim error`);
}
});
});
it('Telephony_Sim_getDefaultVoiceSlotId_0100', 0, async function (done) {
sim.getDefaultVoiceSlotId((err, data) => {
......@@ -70,43 +70,65 @@ describe('SimManagerTest', function () {
});
});
/**
* @tc.number Telephony_Sim_constantValidate_0100
* @tc.name SIM card constant validation
* @tc.desc Function test
*/
/**
* @tc.number Telephony_Sim_constantValidate_0100
* @tc.name SIM card constant validation
* @tc.desc Function test
*/
it('Telephony_Sim_constantValidate_0100', 0, async function (done) {
console.info(`Telephony_Sim_constantValidate_0100 start`);
expect(sim.SimState.SIM_STATE_UNKNOWN !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_NOT_PRESENT !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_LOCKED !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_NOT_READY !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_READY !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_LOADED !== env.INVALID_VALUE).assertTrue();
expect(sim.UNKNOWN_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_SIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_USIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_RUIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_CG_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.CT_NATIONAL_ROAMING_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.CU_DUAL_MODE_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_TELECOM_LTE_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_UG_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_ISIM_CARD !== env.INVALID_VALUE).assertTrue();
console.info(`Telephony_Sim_constantValidate_0100 finish`);
console.info(`Telephony_Sim_constantValidate_0100 start`);
expect(sim.SimState.SIM_STATE_UNKNOWN !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_NOT_PRESENT !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_LOCKED !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_NOT_READY !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_READY !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_LOADED !== env.INVALID_VALUE).assertTrue();
expect(sim.UNKNOWN_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_SIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_USIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_RUIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_CG_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.CT_NATIONAL_ROAMING_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.CU_DUAL_MODE_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_TELECOM_LTE_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_UG_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_ISIM_CARD !== env.INVALID_VALUE).assertTrue();
console.info(`Telephony_Sim_constantValidate_0100 finish`);
done();
});
/**
* @tc.number Telephony_Sim_getISOCountryCodeForSim_Async_0200
* @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getISOCountryCodeForSim_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getISOCountryCodeForSim_Async_0200';
sim.getISOCountryCodeForSim(env.SLOTID2, (err, data) => {
if (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getISOCountryCodeForSim_Async_0200
* @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getISOCountryCodeForSim_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getISOCountryCodeForSim_Async_0200';
sim.getISOCountryCodeForSim(env.SLOTID2, (err, data) => {
if (err) {
/**
* @tc.number Telephony_Sim_getISOCountryCodeForSim_Promise_0200
* @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getISOCountryCodeForSim_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getISOCountryCodeForSim_Promise_0200';
try {
var data = await sim.getISOCountryCodeForSim(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
......@@ -116,39 +138,39 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getISOCountryCodeForSim_Promise_0200
* @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getISOCountryCodeForSim_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getISOCountryCodeForSim_Promise_0200';
try {
var data = await sim.getISOCountryCodeForSim(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
/**
* @tc.number Telephony_Sim_getSimOperatorNumeric_Async_0200
* @tc.name Enter exception parameters to test whether the getSimOperatorNumeric interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimOperatorNumeric_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimOperatorNumeric_Async_0200';
sim.getSimOperatorNumeric(env.SLOTID2, (err, data) => {
if (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimOperatorNumeric_Async_0200
* @tc.name Enter exception parameters to test whether the getSimOperatorNumeric interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimOperatorNumeric_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimOperatorNumeric_Async_0200';
sim.getSimOperatorNumeric(env.SLOTID2, (err, data) => {
if (err) {
/**
* @tc.number Telephony_Sim_getSimOperatorNumeric_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimOperatorNumeric interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimOperatorNumeric_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimOperatorNumeric_Promise_0200';
try {
var data = await sim.getSimOperatorNumeric(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
......@@ -158,39 +180,38 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimOperatorNumeric_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimOperatorNumeric interface function
* can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimOperatorNumeric_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimOperatorNumeric_Promise_0200';
try {
var data = await sim.getSimOperatorNumeric(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
/**
* @tc.number Telephony_Sim_getSimSpn_Async_0200
* @tc.name Enter exception parameters to test whether the getSimSpn interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimSpn_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimSpn_Async_0200';
sim.getSimSpn(env.SLOTID2, (err, data) => {
if (err) {
console.info(`${CASE_NAME} fail: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimSpn_Async_0200
* @tc.name Enter exception parameters to test whether the getSimSpn interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimSpn_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimSpn_Async_0200';
sim.getSimSpn(env.SLOTID2, (err, data) => {
if (err) {
console.info(`${CASE_NAME} fail: ${err.message}`);
/**
* @tc.number Telephony_Sim_getSimSpn_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimSpn interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimSpn_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimSpn_Promise_0200';
try {
var data = await sim.getSimSpn(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
......@@ -199,37 +220,37 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimSpn_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimSpn interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimSpn_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimSpn_Promise_0200';
try {
var data = await sim.getSimSpn(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
/**
* @tc.number Telephony_Sim_getSimState_Async_0200
* @tc.name Enter exception parameters to test whether the getSimState interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimState_Async_0200', 0, async function (done) {
sim.getSimState(env.SLOTID2, (err, data) => {
const CASE_NAME = 'Telephony_Sim_getSimState_Async_0200';
if (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimState_Async_0200
* @tc.name Enter exception parameters to test whether the getSimState interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimState_Async_0200', 0, async function (done) {
sim.getSimState(env.SLOTID2, (err, data) => {
const CASE_NAME = 'Telephony_Sim_getSimState_Async_0200';
if (err) {
/**
* @tc.number Telephony_Sim_getSimState_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimState interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimState_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimState_Promise_0200';
try {
var data = await sim.getSimState(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
......@@ -239,262 +260,241 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
});
/**
* @tc.number Telephony_Sim_getSimState_Promise_0200
* @tc.name Enter exception parameters to test whether the getSimState interface function can execute normally.
* @tc.desc Function test
*/
it('Telephony_Sim_getSimState_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getSimState_Promise_0200';
try {
var data = await sim.getSimState(env.SLOTID2);
} catch (err) {
console.info(`${CASE_NAME} expect err: ${err.message}`);
console.info(`${CASE_NAME} finish`);
done();
return;
}
expect().assertFail();
console.info(`${CASE_NAME} fail, data = ${data}`);
done();
});
/**
* @tc.number Telephony_Sim_isSimActive_Async_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) {
/**
* @tc.number Telephony_Sim_isSimActive_Async_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) {
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(8300001);
done();
});
});
});
/**
* @tc.number Telephony_Sim_isSimActive_Promise_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) {
let promise = sim.isSimActive(env.SLOTID2);
promise.then(data => {
console.log(`isSimActive success, promise: data->${JSON.stringify(data)}`);
expect(data).assertFalse();
done();
}).catch(err => {
console.info("isSimActive promise err info :" + JSON.stringify(err));
expect(err.code).assertEqual(202);
done();
/**
* @tc.number Telephony_Sim_isSimActive_Promise_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) {
let promise = sim.isSimActive(env.SLOTID2);
promise.then(data => {
console.log(`isSimActive success, promise: data->${JSON.stringify(data)}`);
expect(data).assertFalse();
done();
}).catch(err => {
console.info("isSimActive promise err info :" + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
});
});
});
/**
/**
* @tc.number Telephony_Sim_hasSimCard_Async_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_hasSimCard_Async_0600', 0, async function (done) {
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: ' + JSON.stringify(err));
done();
return;
}
console.info(CASE_NAME + ' finish' + JSON.stringify(data));
it('Telephony_Sim_hasSimCard_Async_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600';
sim.hasSimCard(env.SLOTID2, (err, data) => {
if (err) {
expect(err.code).assertEqual(8300001);
console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err));
done();
return;
}
console.info(CASE_NAME + ' finish' + JSON.stringify(data));
});
});
});
/**
/**
* @tc.number Telephony_Sim_hasSimCard_Promise_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
* check the callback value, and expect the callback result flase
* @tc.desc Function test
*/
it('Telephony_Sim_hasSimCard_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Promise_0600';
try {
let data = await sim.hasSimCard(env.SLOTID2);
} catch (err) {
expect(err.code).assertEqual(202);
console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err));
it('Telephony_Sim_hasSimCard_Promise_0600', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Promise_0600';
try {
let data = await sim.hasSimCard(env.SLOTID2);
} catch (err) {
expect(err.code).assertEqual(8300001);
console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err));
done();
return;
}
console.info(CASE_NAME + ' finish');
});
/**
* @tc.number Telephony_Sim_getMaxSimCount_0100
* @tc.name Test the getMaxSimCount interface and view the callback result
* @tc.desc Function test
*/
it('Telephony_Sim_getMaxSimCount_0100', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_getMaxSimCount_0100';
let simCount = sim.getMaxSimCount();
expect(simCount > env.SIM_MIN_COUNT).assertTrue();
console.info(`${CASE_NAME} test finish.`);
done();
return;
}
console.info(CASE_NAME + ' finish');
});
});
/**
* @tc.number Telephony_Sim_getMaxSimCount_0100
* @tc.name Test the getMaxSimCount interface and view the callback result
* @tc.desc Function test
*/
it('Telephony_Sim_getMaxSimCount_0100', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_getMaxSimCount_0100';
let simCount = sim.getMaxSimCount();
expect(simCount > env.SIM_MIN_COUNT).assertTrue();
console.info(`${CASE_NAME} test finish.`);
done();
});
/**
* @tc.number Telephony_Sim_GetCardType_Async_0400
* @tc.name Verify that the slotId of the GetCardType async callback interface is abnormal
* and enter parameter 2, and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_GetCardType_Async_0400', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_GetCardType_Async_0400';
sim.getCardType(env.SLOTID2, (err, cardType) => {
if (err) {
console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err));
expect(err.code).assertEqual(8300001);
done();
return;
}
console.info(CASE_NAME + ' finish' + JSON.stringify(cardType));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_GetCardType_Async_0400
* @tc.name Verify that the slotId of the GetCardType async callback interface is abnormal
* and enter parameter 2, and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_GetCardType_Async_0400', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_GetCardType_Async_0400';
sim.getCardType(env.SLOTID2, (err, cardType) => {
if (err) {
/**
* @tc.number Telephony_Sim_GetCardType_Promise_0400
* @tc.name Verify that the slotId of the GetCardType promise interface is abnormal
* and enter parameter 2, and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_GetCardType_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_GetCardType_Promise_0400';
try {
const cardType = await sim.getCardType(env.SLOTID2);
console.info(CASE_NAME + ' finish');
} catch (err) {
console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err));
expect(err.code).assertEqual(202);
done();
return;
expect(err.code).assertEqual(8300001);
}
console.info(CASE_NAME + ' finish' + JSON.stringify(cardType));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_GetCardType_Promise_0400
* @tc.name Verify that the slotId of the GetCardType promise interface is abnormal
* and enter parameter 2, and check the callback value
* @tc.desc Function test
*/
it('Telephony_Sim_GetCardType_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_GetCardType_Promise_0400';
try {
const cardType = await sim.getCardType(env.SLOTID2);
console.info(CASE_NAME + ' finish');
} catch (err) {
console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err));
expect(err.code).assertEqual(202);
}
done();
});
/**
* @tc.number Telephony_Sim_hasOperatorPrivileges_Async_0400
* @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
* check the callback result
* @tc.desc Function test
*/
it('Telephony_Sim_hasOperatorPrivileges_Async_0400', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Async_0400';
sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => {
if (error) {
console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error));
expect(error.code).assertEqual(8300001);
done();
return;
}
console.info(CASE_NAME + ' finish' + JSON.stringify(result));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_hasOperatorPrivileges_Async_0400
* @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
* check the callback result
* @tc.desc Function test
*/
it('Telephony_Sim_hasOperatorPrivileges_Async_0400', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Async_0400';
sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => {
if (error) {
console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error));
expect(error.code).assertEqual(202);
/**
* @tc.number Telephony_Sim_hasOperatorPrivileges_Promise_0400
* @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
* check the returned result
* @tc.desc Function test
*/
it('Telephony_Sim_hasOperatorPrivileges_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Promise_0400';
try {
const result = await sim.hasOperatorPrivileges(env.SLOTID2);
console.info(CASE_NAME + ' finish' + JSON.stringify(result));
expect().assertFail();
done();
return;
} catch (error) {
console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error));
expect(error.code).assertEqual(8300001);
}
console.info(CASE_NAME + ' finish' + JSON.stringify(result));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Sim_hasOperatorPrivileges_Promise_0400
* @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
* check the returned result
* @tc.desc Function test
*/
it('Telephony_Sim_hasOperatorPrivileges_Promise_0400', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Promise_0400';
try {
const result = await sim.hasOperatorPrivileges(env.SLOTID2);
console.info(CASE_NAME + ' finish' + JSON.stringify(result));
expect().assertFail();
done();
} catch (error) {
console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error));
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) {
/**
* @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;
}
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) {
/**
* @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();
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();
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) {
/**
* @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;
}
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) {
/**
* @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();
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();
console.info("Telephony_Sim_getOpName_Promise_0100 err = " + JSON.stringify(err));
expect(err.code).assertEqual(-1);
done();
});
});
})
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册