From ed612a2f4a196f31f1272b7e5b3eb6b3cd667097 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Mon, 1 Jul 2024 15:51:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E9=83=A8?= =?UTF-8?q?=E5=88=86=E7=A4=BA=E4=BE=8B=E9=A1=B5=E9=9D=A2=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 14 +- .../request-payment}/order-detail.uvue | 0 .../request-payment-uni-pay.uvue | 0 .../unicloud-call-function.test.js | 33 -- .../unicloud-call-function.uvue | 108 ------ .../unicloud-database/unicloud-database.uvue | 322 ------------------ .../unicloud-import-object.uvue | 161 --------- .../unicloud/unicloud/call-function.test.js | 2 +- .../unicloud/cloud-object.test.js} | 2 +- .../unicloud/database.test.js} | 2 +- .../websocket/websocket-socketTask.test.js | 18 + pages/component/unicloud-db/add.uvue | 117 ------- pages/component/unicloud-db/detail.uvue | 110 ------ pages/component/unicloud-db/edit.uvue | 170 --------- pages/component/unicloud-db/types.uts | 25 -- .../unicloud-db/contacts}/add.uvue | 0 .../unicloud-db/contacts}/detail.uvue | 0 .../unicloud-db/contacts}/edit.uvue | 0 .../unicloud-db/contacts}/list.uvue | 0 .../unicloud-db/contacts}/types.uts | 0 .../unicloud-db/unicloud-db/datacom.uvue | 70 ---- .../unicloud-db/mixin-datacom.test.js | 20 -- .../unicloud-db/mixin-datacom.uvue | 27 -- .../unicloud-db/mixin-datacom}/datacom.uvue | 0 .../mixin-datacom}/mixin-datacom.test.js | 0 .../mixin-datacom}/mixin-datacom.uvue | 0 pages/pages.test.js | 24 +- 27 files changed, 40 insertions(+), 1185 deletions(-) rename pages/API/{request-payment-uni-pay => request-payment/request-payment}/order-detail.uvue (100%) rename pages/API/{request-payment-uni-pay => request-payment/request-payment}/request-payment-uni-pay.uvue (100%) delete mode 100644 pages/API/unicloud-call-function/unicloud-call-function.test.js delete mode 100644 pages/API/unicloud-call-function/unicloud-call-function.uvue delete mode 100644 pages/API/unicloud-database/unicloud-database.uvue delete mode 100644 pages/API/unicloud-import-object/unicloud-import-object.uvue rename pages/API/{unicloud-import-object/unicloud-import-object.test.js => unicloud/unicloud/cloud-object.test.js} (93%) rename pages/API/{unicloud-database/unicloud-database.test.js => unicloud/unicloud/database.test.js} (95%) create mode 100644 pages/API/websocket/websocket-socketTask.test.js delete mode 100644 pages/component/unicloud-db/add.uvue delete mode 100644 pages/component/unicloud-db/detail.uvue delete mode 100644 pages/component/unicloud-db/edit.uvue delete mode 100644 pages/component/unicloud-db/types.uts rename pages/component/{unicloud-db-contacts => unicloud-db/unicloud-db/contacts}/add.uvue (100%) rename pages/component/{unicloud-db-contacts => unicloud-db/unicloud-db/contacts}/detail.uvue (100%) rename pages/component/{unicloud-db-contacts => unicloud-db/unicloud-db/contacts}/edit.uvue (100%) rename pages/component/{unicloud-db-contacts => unicloud-db/unicloud-db/contacts}/list.uvue (100%) rename pages/component/{unicloud-db-contacts => unicloud-db/unicloud-db/contacts}/types.uts (100%) delete mode 100644 pages/component/unicloud-db/unicloud-db/datacom.uvue delete mode 100644 pages/component/unicloud-db/unicloud-db/mixin-datacom.test.js delete mode 100644 pages/component/unicloud-db/unicloud-db/mixin-datacom.uvue rename pages/component/{datacom => unicloud-db/unicloud-db/mixin-datacom}/datacom.uvue (100%) rename pages/component/{datacom => unicloud-db/unicloud-db/mixin-datacom}/mixin-datacom.test.js (100%) rename pages/component/{datacom => unicloud-db/unicloud-db/mixin-datacom}/mixin-datacom.uvue (100%) diff --git a/pages.json b/pages.json index 80ad54f8..a5a46293 100644 --- a/pages.json +++ b/pages.json @@ -283,32 +283,32 @@ } }, { - "path": "pages/component/unicloud-db/unicloud-db", + "path": "pages/component/unicloud-db/unicloud-db/contacts/list", "style": { "navigationBarTitleText": "联系人", "enablePullDownRefresh": true } }, { - "path": "pages/component/unicloud-db/add", + "path": "pages/component/unicloud-db/unicloud-db/contacts/add", "style": { "navigationBarTitleText": "新增联系人" } }, { - "path": "pages/component/unicloud-db/edit", + "path": "pages/component/unicloud-db/unicloud-db/contacts/edit", "style": { "navigationBarTitleText": "编辑联系人" } }, { - "path": "pages/component/unicloud-db/detail", + "path": "pages/component/unicloud-db/unicloud-db/contacts/detail", "style": { "navigationBarTitleText": "" } }, { - "path": "pages/component/unicloud-db/unicloud-db/mixin-datacom", + "path": "pages/component/unicloud-db/unicloud-db/mixin-datacom/mixin-datacom", "style": { "navigationBarTitleText": "mixinDatacom" } @@ -886,14 +886,14 @@ // #endif // #ifdef APP || WEB { - "path": "pages/API/request-payment-uni-pay/request-payment-uni-pay", + "path": "pages/API/request-payment/request-payment/request-payment-uni-pay", "style": { "navigationBarTitleText": "uni-pay示例", "enablePullDownRefresh": false } }, { - "path": "pages/API/request-payment-uni-pay/order-detail", + "path": "pages/API/request-payment/request-payment/order-detail", "style": { "navigationBarTitleText": "订单详情示例", "enablePullDownRefresh": false diff --git a/pages/API/request-payment-uni-pay/order-detail.uvue b/pages/API/request-payment/request-payment/order-detail.uvue similarity index 100% rename from pages/API/request-payment-uni-pay/order-detail.uvue rename to pages/API/request-payment/request-payment/order-detail.uvue diff --git a/pages/API/request-payment-uni-pay/request-payment-uni-pay.uvue b/pages/API/request-payment/request-payment/request-payment-uni-pay.uvue similarity index 100% rename from pages/API/request-payment-uni-pay/request-payment-uni-pay.uvue rename to pages/API/request-payment/request-payment/request-payment-uni-pay.uvue diff --git a/pages/API/unicloud-call-function/unicloud-call-function.test.js b/pages/API/unicloud-call-function/unicloud-call-function.test.js deleted file mode 100644 index 2917aef6..00000000 --- a/pages/API/unicloud-call-function/unicloud-call-function.test.js +++ /dev/null @@ -1,33 +0,0 @@ -const PAGE_PATH = '/pages/API/unicloud-call-function/unicloud-call-function' - -describe('unicloud-call-function', () => { - let page - beforeAll(async () => { - page = await program.reLaunch(PAGE_PATH) - await page.waitFor(500) - await page.setData({ - isUniTest: true - }) - }) - - it('callFunction', async () => { - await page.callMethod('callFunction') - const { - callFunctionResult, - callFunctionError, - } = await page.data() - console.error(callFunctionResult) - console.error(callFunctionError) - expect(callFunctionResult['showMessage']).toBe("Hello uniCloud function") - expect(callFunctionResult['event']['num']).toBe(1) - expect(callFunctionResult['event']['str']).toBe('ABC') - }) - - it('callFunctionWithGeneric', async () => { - await page.callMethod('callFunctionWithGeneric') - const { - genericDemoShowMessage, - } = await page.data() - expect(genericDemoShowMessage).toBe("Hello uniCloud function") - }) -}) diff --git a/pages/API/unicloud-call-function/unicloud-call-function.uvue b/pages/API/unicloud-call-function/unicloud-call-function.uvue deleted file mode 100644 index 58f32841..00000000 --- a/pages/API/unicloud-call-function/unicloud-call-function.uvue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - diff --git a/pages/API/unicloud-database/unicloud-database.uvue b/pages/API/unicloud-database/unicloud-database.uvue deleted file mode 100644 index f37730e2..00000000 --- a/pages/API/unicloud-database/unicloud-database.uvue +++ /dev/null @@ -1,322 +0,0 @@ - - - - - diff --git a/pages/API/unicloud-import-object/unicloud-import-object.uvue b/pages/API/unicloud-import-object/unicloud-import-object.uvue deleted file mode 100644 index 1b71ea1e..00000000 --- a/pages/API/unicloud-import-object/unicloud-import-object.uvue +++ /dev/null @@ -1,161 +0,0 @@ - - - - - diff --git a/pages/API/unicloud/unicloud/call-function.test.js b/pages/API/unicloud/unicloud/call-function.test.js index acd034b6..65d0cf04 100644 --- a/pages/API/unicloud/unicloud/call-function.test.js +++ b/pages/API/unicloud/unicloud/call-function.test.js @@ -1,4 +1,4 @@ -const PAGE_PATH = '/pages/API/call-function/call-function' +const PAGE_PATH = '/pages/API/unicloud/unicloud/call-function' describe('unicloud-call-function', () => { let page diff --git a/pages/API/unicloud-import-object/unicloud-import-object.test.js b/pages/API/unicloud/unicloud/cloud-object.test.js similarity index 93% rename from pages/API/unicloud-import-object/unicloud-import-object.test.js rename to pages/API/unicloud/unicloud/cloud-object.test.js index 46fbf87c..ec731d20 100644 --- a/pages/API/unicloud-import-object/unicloud-import-object.test.js +++ b/pages/API/unicloud/unicloud/cloud-object.test.js @@ -1,4 +1,4 @@ -const PAGE_PATH = '/pages/API/unicloud-import-object/unicloud-import-object' +const PAGE_PATH = '/pages/API/unicloud/unicloud/cloud-object' describe('unicloud-import-object', () => { let page diff --git a/pages/API/unicloud-database/unicloud-database.test.js b/pages/API/unicloud/unicloud/database.test.js similarity index 95% rename from pages/API/unicloud-database/unicloud-database.test.js rename to pages/API/unicloud/unicloud/database.test.js index cec19a63..d268f97d 100644 --- a/pages/API/unicloud-database/unicloud-database.test.js +++ b/pages/API/unicloud/unicloud/database.test.js @@ -1,4 +1,4 @@ -const PAGE_PATH = '/pages/API/unicloud-database/unicloud-database' +const PAGE_PATH = '/pages/API/unicloud/unicloud/database' describe('unicloud-database', () => { let page diff --git a/pages/API/websocket/websocket-socketTask.test.js b/pages/API/websocket/websocket-socketTask.test.js new file mode 100644 index 00000000..0b53e85d --- /dev/null +++ b/pages/API/websocket/websocket-socketTask.test.js @@ -0,0 +1,18 @@ +const PAGE_PATH = '/pages/API/websocket/websocket-socketTask' + +describe('ExtApi-WebSocket', () => { + + let page; + let res; + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(600); + await page.callMethod('jest_connectSocket'); + await page.waitFor(1500); + res = await page.data('jest_result'); + }); + + it('Check ', async () => { + expect(res).toBe(2); + }); +}); diff --git a/pages/component/unicloud-db/add.uvue b/pages/component/unicloud-db/add.uvue deleted file mode 100644 index fd216944..00000000 --- a/pages/component/unicloud-db/add.uvue +++ /dev/null @@ -1,117 +0,0 @@ -