From 7668f8e8aa63cbeca71f20aa70dbcbb3e43f2bb5 Mon Sep 17 00:00:00 2001 From: liuhaonan2 Date: Thu, 1 Dec 2022 17:07:19 +0800 Subject: [PATCH] Signed-off-by: liuhaonan2 --- msdp/BUILD.gn | 4 +- .../js/test/device_status_unittest.test.js | 433 +++++++++++++++++- 2 files changed, 417 insertions(+), 20 deletions(-) diff --git a/msdp/BUILD.gn b/msdp/BUILD.gn index 532ee3a35..56f2afb56 100644 --- a/msdp/BUILD.gn +++ b/msdp/BUILD.gn @@ -13,7 +13,5 @@ import("//build/ohos_var.gni") group("msdp") { testonly = true - deps = [ - "device_status:msdp_device_status_test" - ] + deps = [ "device_status:msdp_device_status_test" ] } diff --git a/msdp/device_status/src/main/js/test/device_status_unittest.test.js b/msdp/device_status/src/main/js/test/device_status_unittest.test.js index a87158a15..da1973d58 100644 --- a/msdp/device_status/src/main/js/test/device_status_unittest.test.js +++ b/msdp/device_status/src/main/js/test/device_status_unittest.test.js @@ -70,7 +70,7 @@ describe('DeviceStatusUnitTest', function () { it('msdp_test_devices_status_003', 0, function (done) { console.log("msdp_test_devices_status_003 start"); try { - devicestatus.once("highStill", (data) => { + stationary.once("highStill", (data) => { expect(data.state == -1).assertTrue(); done(); }) @@ -81,13 +81,412 @@ describe('DeviceStatusUnitTest', function () { }) /** - * @tc.number DeviceStatus_004 + * @tc.number DeviceStatus_004 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_004', 0, function (done) { + console.log("msdp_test_devices_status_004 start"); + try { + stationary.on("fineStill", ActivityEvent.ENTER_EXIT, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_005 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_005', 0, function (done) { + console.log("msdp_test_devices_status_005 start"); + try { + stationary.off("fineStill", ActivityEvent.ENTER_EXIT, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_006 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_006', 0, function (done) { + console.log("msdp_test_devices_status_006 start"); + try { + stationary.once("fineStill", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_007 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_007', 0, function (done) { + console.log("msdp_test_devices_status_007 start"); + try { + stationary.on("carBluetooth", ActivityEvent.ENTER_EXIT, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_008 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_008', 0, function (done) { + console.log("msdp_test_devices_status_008 start"); + try { + stationary.off("carBluetooth", ActivityEvent.ENTER_EXIT, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_009 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_009', 0, function (done) { + console.log("msdp_test_devices_status_009 start"); + try { + stationary.once("carBluetooth", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_010 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_010', 0, function (done) { + console.log("msdp_test_devices_status_010 start"); + try { + stationary.on("Type_Unknow", ActivityEvent.ENTER_EXIT, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_011 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_011', 0, function (done) { + console.log("msdp_test_devices_status_011 start"); + try { + stationary.off("Type_Unknow", ActivityEvent.ENTER_EXIT, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_012 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_012', 0, function (done) { + console.log("msdp_test_devices_status_012 start"); + try { + stationary.once("Type_Unknow", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_013 * @tc.name * @tc.callback:AsyncCallback * parameter unknown */ - it('msdp_test_devices_status_004', 0, function (done) { - console.log("msdp_test_devices_status_004 start"); + it('msdp_test_devices_status_013', 0, function (done) { + console.log("msdp_test_devices_status_013 start"); + try { + stationary.on("highStill", ActivityEvent.ENTER, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_014 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_014', 0, function (done) { + console.log("msdp_test_devices_status_014 start"); + try { + stationary.off("highStill", ActivityEvent.ENTER, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_015 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_015', 0, function (done) { + console.log("msdp_test_devices_status_015 start"); + try { + stationary.once("highStill", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_016 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_016', 0, function (done) { + console.log("msdp_test_devices_status_016 start"); + try { + stationary.on("fineStill", ActivityEvent.ENTER, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_017 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_017', 0, function (done) { + console.log("msdp_test_devices_status_017 start"); + try { + stationary.off("fineStill", ActivityEvent.ENTER, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_018 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_018', 0, function (done) { + console.log("msdp_test_devices_status_018 start"); + try { + stationary.once("fineStill", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_019 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_019', 0, function (done) { + console.log("msdp_test_devices_status_019 start"); + try { + stationary.on("carBluetooth", ActivityEvent.ENTER, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_020 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_020', 0, function (done) { + console.log("msdp_test_devices_status_020 start"); + try { + stationary.off("carBluetooth", ActivityEvent.ENTER, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_021 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_021', 0, function (done) { + console.log("msdp_test_devices_status_021 start"); + try { + stationary.once("carBluetooth", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_022 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_022', 0, function (done) { + console.log("msdp_test_devices_status_022 start"); + try { + stationary.on("Type_Unknow", ActivityEvent.ENTER, 1, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_023 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_023', 0, function (done) { + console.log("msdp_test_devices_status_023 start"); + try { + stationary.off("Type_Unknow", ActivityEvent.ENTER, (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_024 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_024', 0, function (done) { + console.log("msdp_test_devices_status_024 start"); + try { + stationary.once("Type_Unknow", (data) => { + expect(data.state == -1).assertTrue(); + done(); + }) + } catch (error) { + console.error('error=' + error); + done(); + } + }) + + /** + * @tc.number DeviceStatus_025 + * @tc.name + * @tc.callback:AsyncCallback + * parameter unknown + */ + it('msdp_test_devices_status_025', 0, function (done) { + console.log("msdp_test_devices_status_025 start"); try { stationary.on("relativeStill", ActivityEvent.ENTER, 1, (data) => { expect(data.state == -1).assertTrue(); @@ -101,13 +500,13 @@ describe('DeviceStatusUnitTest', function () { /** - * @tc.number DeviceStatus_005 + * @tc.number DeviceStatus_026 * @tc.name * @tc.callback:AsyncCallback * parameter unknown */ - it('msdp_test_devices_status_005', 0, function (done) { - console.log("msdp_test_devices_status_005 start"); + it('msdp_test_devices_status_026', 0, function (done) { + console.log("msdp_test_devices_status_026 start"); try { stationary.off("relativeStill", ActivityEvent.ENTER, (data) => { expect(data.state == -1).assertTrue(); @@ -121,15 +520,15 @@ describe('DeviceStatusUnitTest', function () { /** - * @tc.number DeviceStatus_006 + * @tc.number DeviceStatus_027 * @tc.name * @tc.callback:AsyncCallback * parameter unknown */ - it('msdp_test_devices_status_006', 0, function (done) { - console.log("msdp_test_devices_status_006 start"); + it('msdp_test_devices_status_027', 0, function (done) { + console.log("msdp_test_devices_status_027 start"); try { - devicestatus.once("relativeStill", (data) => { + stationary.once("relativeStill", (data) => { expect(data.state == -1).assertTrue(); done(); }) @@ -140,13 +539,13 @@ describe('DeviceStatusUnitTest', function () { }) /** - * @tc.number DeviceStatus_007 + * @tc.number DeviceStatus_028 * @tc.name * @tc.callback:AsyncCallback * parameter unknown */ - it('msdp_test_devices_status_007', 0, function (done) { - console.log("msdp_test_devices_status_007 start"); + it('msdp_test_devices_status_028', 0, function (done) { + console.log("msdp_test_devices_status_028 start"); try { stationary.on("relativeStill", ActivityEvent.EXIT, 1, (data) => { expect(data.state == -1).assertTrue(); @@ -160,13 +559,13 @@ describe('DeviceStatusUnitTest', function () { /** - * @tc.number DeviceStatus_008 + * @tc.number DeviceStatus_029 * @tc.name * @tc.callback:AsyncCallback * parameter unknown */ - it('msdp_test_devices_status_008', 0, function (done) { - console.log("msdp_test_devices_status_008 start"); + it('msdp_test_devices_status_029', 0, function (done) { + console.log("msdp_test_devices_status_029 start"); try { stationary.off("relativeStill", ActivityEvent.EXIT, (data) => { expect(data.state == -1).assertTrue(); -- GitLab