未验证 提交 5a698cfb 编写于 作者: O openharmony_ci 提交者: Gitee

!9804 unsubscribe接口增加等待时间,保证注册成功

Merge pull request !9804 from 高曦/master
...@@ -38,7 +38,6 @@ export default function Telephony_NetManager_NetWorkTest() { ...@@ -38,7 +38,6 @@ export default function Telephony_NetManager_NetWorkTest() {
console.info("NetManager getType " + JSON.stringify(data)); console.info("NetManager getType " + JSON.stringify(data));
expect(data.type == "none").assertTrue(); expect(data.type == "none").assertTrue();
expect(data.metered == false).assertTrue(); expect(data.metered == false).assertTrue();
network.unsubscribe();
done(); done();
}, },
fail: function (data, code) { fail: function (data, code) {
...@@ -69,7 +68,6 @@ export default function Telephony_NetManager_NetWorkTest() { ...@@ -69,7 +68,6 @@ export default function Telephony_NetManager_NetWorkTest() {
console.info("NetManager getType 1 " + JSON.stringify(data)); console.info("NetManager getType 1 " + JSON.stringify(data));
expect(data.type == "none").assertTrue(); expect(data.type == "none").assertTrue();
expect(data.metered == false).assertTrue(); expect(data.metered == false).assertTrue();
network.unsubscribe();
done(); done();
console.info("NetManager Telephony_NetManager_NetWorkTest_GetType_none_1 end"); console.info("NetManager Telephony_NetManager_NetWorkTest_GetType_none_1 end");
}, },
...@@ -101,16 +99,19 @@ export default function Telephony_NetManager_NetWorkTest() { ...@@ -101,16 +99,19 @@ export default function Telephony_NetManager_NetWorkTest() {
console.info("NetManager subscribe " + JSON.stringify(data)); console.info("NetManager subscribe " + JSON.stringify(data));
expect(data.type == "none").assertTrue(); expect(data.type == "none").assertTrue();
expect(data.metered == false).assertTrue(); expect(data.metered == false).assertTrue();
network.unsubscribe();
done();
}, },
fail: function (data, code) { fail: function (data, code) {
console.log("data:" + JSON.stringify(data) + " code:" + JSON.stringify(code)); console.log("data:" + JSON.stringify(data) + " code:" + JSON.stringify(code));
expect().assertFail(); expect().assertFail();
done(); done();
} }
}) });
}) setTimeout(()=>{
network.unsubscribe();
console.info("async function unsubscribe end");
done();
},1500);
});
}); });
/** /**
...@@ -130,16 +131,19 @@ export default function Telephony_NetManager_NetWorkTest() { ...@@ -130,16 +131,19 @@ export default function Telephony_NetManager_NetWorkTest() {
console.info("NetManager subscribe " + JSON.stringify(data)); console.info("NetManager subscribe " + JSON.stringify(data));
expect(data.type == "none").assertTrue(); expect(data.type == "none").assertTrue();
expect(data.metered == false).assertTrue(); expect(data.metered == false).assertTrue();
network.unsubscribe();
done();
}, },
fail: function (data, code) { fail: function (data, code) {
console.log("data:" + JSON.stringify(data) + " code:" + JSON.stringify(code)); console.log("data:" + JSON.stringify(data) + " code:" + JSON.stringify(code));
expect().assertFail(); expect().assertFail();
done(); done();
} }
}) });
}) setTimeout(()=>{
network.unsubscribe();
console.info("async function unsubscribe end");
done();
},1500);
});
}); });
}); });
} }
\ No newline at end of file
...@@ -18,12 +18,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -18,12 +18,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export default function Telephony_NetManager_NetWorkTest() { export default function Telephony_NetManager_NetWorkTest() {
describe("Telephony_NetManager_NetWorkTest", function () { describe("Telephony_NetManager_NetWorkTest", function () {
afterEach(function(){
setTimeout(()=>{
network.unsubscribe();
console.info("async function unsubscribe end");
},100);
});
/** /**
* @tc.number Telephony_NetManager_NetWorkTest_GetType_WiFi_0100 * @tc.number Telephony_NetManager_NetWorkTest_GetType_WiFi_0100
...@@ -60,13 +54,17 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -60,13 +54,17 @@ describe("Telephony_NetManager_NetWorkTest", function () {
console.info("NetManager subscribe "+JSON.stringify(data)); console.info("NetManager subscribe "+JSON.stringify(data));
expect(data.type === "WiFi").assertTrue(); expect(data.type === "WiFi").assertTrue();
expect(data.metered === false).assertTrue(); expect(data.metered === false).assertTrue();
done();
}, },
fail : function(data,code){ fail : function(data,code){
expect().assertFail(); expect().assertFail();
done(); done();
} }
}); });
setTimeout(()=>{
network.unsubscribe();
console.info("async function unsubscribe end");
done();
},100);
}); });
/** /**
...@@ -105,13 +103,17 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -105,13 +103,17 @@ describe("Telephony_NetManager_NetWorkTest", function () {
console.info("NetManager subscribe 1 "+JSON.stringify(data)); console.info("NetManager subscribe 1 "+JSON.stringify(data));
expect(data.type === "WiFi").assertTrue(); expect(data.type === "WiFi").assertTrue();
expect(data.metered === false).assertTrue(); expect(data.metered === false).assertTrue();
done();
}, },
fail : function(data,code){ fail : function(data,code){
expect().assertFail(); expect().assertFail();
done(); done();
} }
}); });
setTimeout(()=>{
network.unsubscribe();
console.info("async function unsubscribe end");
done();
},100);
}); });
}); });
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册