提交 1019d6cb 编写于 作者: G gaoxi785

sendshortmessage

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 9a339e86
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
import {describe, it, expect} from '@ohos/hypium'; import {describe, it, expect} from '@ohos/hypium';
import http from '@ohos.net.http'; import http from '@ohos.net.http';
import connection from "@ohos.net.connection"; import connection from "@ohos.net.connection";
import ethernet from '@ohos.net.ethernet'; import socket from '@ohos.net.socket';
type httpProxy = connection.HttpProxy;
export default function httpJsunit() { export default function httpJsunit() {
describe("httpJsunitTest", function () { describe("httpJsunitTest", function () {
...@@ -157,7 +156,13 @@ export default function httpJsunit() { ...@@ -157,7 +156,13 @@ export default function httpJsunit() {
}); });
}).catch(error => { }).catch(error => {
console.log("setAppNet err " + JSON.stringify(error)); console.log("setAppNet err " + JSON.stringify(error));
expect().assertFail();
done();
}); });
}).catch(error => {
console.log("getDefaultNet err " + JSON.stringify(error));
expect().assertFail();
done();
}); });
}); });
...@@ -183,8 +188,36 @@ export default function httpJsunit() { ...@@ -183,8 +188,36 @@ export default function httpJsunit() {
}); });
}).catch(error => { }).catch(error => {
console.log("setAppNet err " + JSON.stringify(error)); console.log("setAppNet err " + JSON.stringify(error));
expect().assertFail();
done();
}); });
}).catch(error => {
console.log("getDefaultNet err " + JSON.stringify(error));
expect().assertFail();
done();
}); });
}); });
/**
* @tc.number Telephony_Connection_Request_Socket_0100
* @tc.name Test type
* @tc.desc Function test
*/
it('Telephony_Connection_Request_Socket_0100', 0, async function (done) {
let caseName = 'Telephony_Connection_Request_Socket_0100';
type HttpProxy = connection.HttpProxy;
type TCPSocket = socket.TCPSocket;
type UDPSocket = socket.UDPSocket;
Test(http.createHttp(),socket.constructTCPSocketInstance(),socket.constructUDPSocketInstance());
function Test(httpProxy:HttpProxy,tcpSocket:TCPSocket,udpSocket:UDPSocket){
except(httpProxy != null).assertTrue();
except(tcpSocket != null).assertTrue();
except(udpSocket != null).assertTrue();
httpRequest.destroy();
tcpSocket.close();
udp.close();
done();
}
}); });
} }
\ No newline at end of file
...@@ -182,7 +182,7 @@ describe('SmsMmsErrorTest', function () { ...@@ -182,7 +182,7 @@ describe('SmsMmsErrorTest', function () {
sendCallback, sendCallback,
deliveryCallback deliveryCallback
}; };
sms.sendMessage(options).then((data)=>{ sms.sendShortMessage(options).then((data)=>{
console.info('Telephony_SmsMms_sendShortMessage_Promise_0100 ' + JSON.stringify(data)); console.info('Telephony_SmsMms_sendShortMessage_Promise_0100 ' + JSON.stringify(data));
expect().assertFail(); expect().assertFail();
done(); done();
...@@ -224,9 +224,9 @@ describe('SmsMmsErrorTest', function () { ...@@ -224,9 +224,9 @@ describe('SmsMmsErrorTest', function () {
sendCallback, sendCallback,
deliveryCallback deliveryCallback
}; };
sms.sendMessage(options,(err,data)=>{ sms.sendShortMessage(options,(err, data)=>{
if(err){ if(err){
expect(error.code == 201).assertTrue(); expect(err.code == 201).assertTrue();
done(); done();
} else { } else {
console.info('Telephony_SmsMms_sendShortMessage_Async_0100 ' + JSON.stringify(data)); console.info('Telephony_SmsMms_sendShortMessage_Async_0100 ' + JSON.stringify(data));
...@@ -234,7 +234,7 @@ describe('SmsMmsErrorTest', function () { ...@@ -234,7 +234,7 @@ describe('SmsMmsErrorTest', function () {
done(); done();
} }
}); });
} catch (err) { } catch (error) {
expect(true).assertFalse(); expect(true).assertFalse();
done(); done();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册