diff --git a/pages/component/unicloud-db/unicloud-db.test.js b/pages/component/unicloud-db/unicloud-db.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0d93113ae5e4d6bb519a96b3ad7fb7e7d199f5ae --- /dev/null +++ b/pages/component/unicloud-db/unicloud-db.test.js @@ -0,0 +1,31 @@ +const PAGE_PATH = '/pages/unicloud-db/unicloud-db' + +describe('unicloud-db', () => { + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(500) + }) + it('add/get/update/remove', async () => { + await page.callMethod('add') + await page.waitFor(3000) + const { + $addResult + } = await page.data() + expect($addResult['id'].length > 0).toBe(true) + + await page.callMethod('update', $addResult['id']) + await page.waitFor(3000) + const { + $updateResult + } = await page.data() + expect($updateResult['updated']).toBe(1) + + await page.callMethod('remove', $addResult['id']) + await page.waitFor(3000) + const { + $removeResult + } = await page.data() + expect($removeResult['deleted']).toBe(1) + }) +}) \ No newline at end of file diff --git a/pages/component/unicloud-db/unicloud-db.uvue b/pages/component/unicloud-db/unicloud-db.uvue new file mode 100644 index 0000000000000000000000000000000000000000..9bec19567f86d4fc495c60dc1069f4aad4cbc248 --- /dev/null +++ b/pages/component/unicloud-db/unicloud-db.uvue @@ -0,0 +1,180 @@ + + + + + \ No newline at end of file diff --git a/uniCloud-aliyun/database/unicloud-db-test.schema.json b/uniCloud-aliyun/database/unicloud-db-test.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..7f4a69440e95ab9334f33c4aa8b1d358125e089b --- /dev/null +++ b/uniCloud-aliyun/database/unicloud-db-test.schema.json @@ -0,0 +1,40 @@ +{ + "bsonType": "object", + "permission": { + "read": true, + "create": true, + "update": true, + "delete": true + }, + "required": ["title", "comment"], + "properties": { + "_id": { + "description": "存储文档 ID(用户 ID),系统自动生成" + }, + "title": { + "bsonType": "string", + "title": "姓名", + "description": "姓名", + "order": 1, + "trim": "both" + }, + "comment": { + "bsonType": "string", + "title": "备注", + "order": 5, + "description": "备注", + "trim": "both", + "component": { + "name": "textarea" + } + }, + "create_date": { + "bsonType": "timestamp", + "description": "创建时间", + "forceDefaultValue": { + "$env": "now" + } + } + }, + "version": "0.0.1" +} \ No newline at end of file