Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uniCloud
提交
e4d06020
H
hello-uniCloud
项目概览
DCloud
/
hello-uniCloud
通知
294
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uniCloud
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e4d06020
编写于
3月 11, 2024
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test
上级
efe7f718
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
775 addition
and
736 deletion
+775
-736
pages/clientDB/permission-demo/permission-demo.test.js
pages/clientDB/permission-demo/permission-demo.test.js
+2
-5
pages/clientDB/permission-field-simple/permission-field-simple.test.js
...B/permission-field-simple/permission-field-simple.test.js
+603
-586
pages/cloudFunction/cloudFunction.test.js
pages/cloudFunction/cloudFunction.test.js
+1
-0
pages/storage/ext-storage-qiniu.test.js
pages/storage/ext-storage-qiniu.test.js
+18
-11
pages/storage/space-storage.test.js
pages/storage/space-storage.test.js
+2
-1
pages/user-info/detail.vue
pages/user-info/detail.vue
+148
-133
pages/user-info/edit.test.js
pages/user-info/edit.test.js
+1
-0
未找到文件。
pages/clientDB/permission-demo/permission-demo.test.js
浏览文件 @
e4d06020
...
...
@@ -55,12 +55,9 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
await
roles
[
2
].
tap
()
const
start
=
Date
.
now
()
await
page
.
waitFor
(
async
()
=>
{
if
(
Date
.
now
()
-
start
>
4000
){
console
.
warn
(
'
链接服务器超时
'
)
return
true
}
const
auditorRole
=
await
page
.
data
(
'
rulo_index
'
)
return
auditorRole
===
2
console
.
log
(
"
auditorRole
"
,
auditorRole
)
return
auditorRole
===
2
||
Date
.
now
()
-
start
>
5000
})
await
page
.
setData
({
"
formData
"
:
{
...
...
pages/clientDB/permission-field-simple/permission-field-simple.test.js
浏览文件 @
e4d06020
此差异已折叠。
点击以展开。
pages/cloudFunction/cloudFunction.test.js
浏览文件 @
e4d06020
...
...
@@ -5,6 +5,7 @@ describe('pages/cloudFunction/cloudFunction.vue', () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
switchTab
(
'
/pages/cloudFunction/cloudFunction
'
)
await
page
.
waitFor
(
'
view
'
)
console
.
log
(
"
page
"
,
page
)
})
it
(
'
云函数页-检查标题
'
,
async
()
=>
{
expect
.
assertions
(
1
);
...
...
pages/storage/ext-storage-qiniu.test.js
浏览文件 @
e4d06020
jest
.
setTimeout
(
20000
)
let
page
,
platform
;
describe
(
'
pages/storage/ext-storage-qiniu.vue
'
,
()
=>
{
let
page
,
platform
;
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
navigateTo
(
'
/pages/storage/ext-storage-qiniu
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
setData
({
'
isTest
'
:
true
})
await
page
.
setData
({
'
isTest
'
:
true
})
platform
=
process
.
env
.
UNI_PLATFORM
})
it
(
'
qiniu-storage-上传文件
'
,
async
()
=>
{
...
...
@@ -16,8 +18,9 @@ describe('pages/storage/ext-storage-qiniu.vue', () => {
isPrivate
:
false
})
console
.
log
(
'
res: ---qiniu
'
,
res
);
expectText
(
res
.
fileID
,
'
qiniu://
'
)
expectText
(
res
.
fileURL
,
'
https://
'
)
await
page
.
waitFor
(
2000
)
expectText
(
res
.
fileID
,
'
qiniu://
'
)
expectText
(
res
.
fileURL
,
'
https://
'
)
})
it
(
'
qiniu-私有文件-上传
'
,
async
()
=>
{
expect
.
assertions
(
2
);
...
...
@@ -27,19 +30,23 @@ describe('pages/storage/ext-storage-qiniu.vue', () => {
isPrivate
:
true
})
console
.
log
(
'
res: ----qiniu---isPrivate
'
,
res
);
expectText
(
res
.
fileID
,
'
qiniu://
'
)
expectText
(
res
.
fileURL
,
'
https://
'
)
await
page
.
waitFor
(
2000
)
expectText
(
res
.
fileID
,
'
qiniu://
'
)
expectText
(
res
.
fileURL
,
'
https://
'
)
})
it
(
'
获取私有文件临时下载链接
'
,
async
()
=>
{
// if(platform === "mp-weixin" || process.env.UNI_PLATFORM.startsWith("app")){return;}
expect
.
assertions
(
3
);
expectText
(
await
page
.
data
(
'
privateFileID
'
),
'
qiniu://jest
'
)
expectText
(
await
page
.
data
(
'
privateFileID
'
),
'
qiniu://jest
'
)
const
res
=
await
page
.
callMethod
(
'
getTempFileURL
'
)
console
.
log
(
'
res: ----私有文件临时下载链接
'
,
res
);
expectText
(
res
,
'
&token
'
)
expectText
(
res
,
'
https://
'
)
await
page
.
waitFor
(
2000
)
expectText
(
res
,
'
&token
'
)
expectText
(
res
,
'
https://
'
)
})
})
function
expectText
(
value
,
expectValue
){
function
expectText
(
value
,
expectValue
)
{
expect
(
value
).
toEqual
(
expect
.
stringContaining
(
expectValue
));
}
\ No newline at end of file
}
pages/storage/space-storage.test.js
浏览文件 @
e4d06020
...
...
@@ -3,7 +3,7 @@ describe('pages/storage/space-storage.vue', () => {
let
page
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
navigateTo
(
'
/pages/storage/space-storage
'
)
page
=
await
program
.
reLaunch
(
'
/pages/storage/space-storage
'
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
space-storage-上传文件
'
,
async
()
=>
{
...
...
@@ -13,6 +13,7 @@ describe('pages/storage/space-storage.vue', () => {
cloudPath
:
Date
.
now
()
+
'
test.png
'
})
console
.
log
(
'
res:
'
,
res
);
await
page
.
waitFor
(
1000
)
expect
(
res
.
success
).
toBeTruthy
()
expect
(
res
.
fileID
).
toEqual
(
expect
.
stringContaining
(
'
https
'
));
})
...
...
pages/user-info/detail.vue
浏览文件 @
e4d06020
<
template
>
<view
class=
"container"
>
<unicloud-db
ref=
"udb"
v-slot:default=
"
{data, loading, error, options}" :options="options" collection="user-info,book,opendb-city-china" field="username,gender,birth_date,weight,mobile,email,url,favorite_book_id{title},address_code{name},party_member,hobby,comment" :where="queryWhere" :getone="true" :manual="true">
<view
v-if=
"error"
>
{{
error
.
message
}}
</view>
<view
v-else-if=
"loading"
>
<uni-load-more
:contentText=
"loadMore"
status=
"loading"
></uni-load-more>
</view>
<view
v-else-if=
"data"
>
<view>
<text>
真实姓名
</text>
<text>
{{
data
.
username
}}
</text>
</view>
<view>
<text>
性别
</text>
<text>
{{
options
.
gender_valuetotext
[
data
.
gender
]
}}
</text>
</view>
<view>
<text>
生日
</text>
<uni-dateformat
:threshold=
"[0, 0]"
:date=
"data.birth_date"
></uni-dateformat>
</view>
<view>
<text>
体重
</text>
<text>
{{
data
.
weight
}}
</text>
</view>
<view>
<text>
手机号码
</text>
<text>
{{
data
.
mobile
}}
</text>
</view>
<view>
<text>
邮箱账号
</text>
<uni-link
:href=
"'mailto:'+data.email"
:text=
"data.email"
></uni-link>
</view>
<view>
<text>
个人博客
</text>
<uni-link
:href=
"data.url"
:download=
"data.url"
:text=
"data.url"
></uni-link>
</view>
<view>
<text>
喜欢的书
</text>
<text>
{{
data
.
favorite_book_id
&&
data
.
favorite_book_id
[
0
]
&&
data
.
favorite_book_id
[
0
].
title
}}
</text>
</view>
<view>
<text>
地址
</text>
<text>
{{
data
.
address_code
&&
data
.
address_code
[
0
]
&&
data
.
address_code
[
0
].
name
}}
</text>
</view>
<view>
<text>
是否为党员
</text>
<text>
{{
data
.
party_member
==
true
?
'
✅
'
:
'
❌
'
}}
</text>
</view>
<view>
<text>
业余爱好
</text>
<uni-data-picker
:localdata=
"options.hobby_valuetotext"
:value=
"data.hobby"
:multiple=
"false"
:readonly=
"true"
:arrow=
"false"
split=
","
></uni-data-picker>
</view>
<view>
<text>
备注
</text>
<text>
{{
data
.
comment
}}
</text>
</view>
</view>
</unicloud-db>
<view
class=
"btns"
>
<button
type=
"primary"
@
click=
"handleUpdate"
>
修改
</button>
<button
type=
"warn"
class=
"btn-delete"
@
click=
"handleDelete"
>
删除
</button>
</view>
</view>
<view
class=
"container"
>
<unicloud-db
ref=
"udb"
v-slot:default=
"
{data, loading, error, options}" :options="options"
collection="user-info,book,opendb-city-china"
field="username,gender,birth_date,weight,mobile,email,url,favorite_book_id{title},address_code{name},party_member,hobby,comment"
:where="queryWhere" :getone="true" :manual="true">
<view
v-if=
"error"
>
{{
error
.
message
}}
</view>
<view
v-else-if=
"loading"
>
<uni-load-more
:contentText=
"loadMore"
status=
"loading"
></uni-load-more>
</view>
<view
v-else-if=
"data"
>
<view>
<text>
真实姓名
</text>
<text>
{{
data
.
username
}}
</text>
</view>
<view>
<text>
性别
</text>
<text>
{{
options
.
gender_valuetotext
[
data
.
gender
]
}}
</text>
</view>
<view>
<text>
生日
</text>
<uni-dateformat
:threshold=
"[0, 0]"
:date=
"data.birth_date"
></uni-dateformat>
</view>
<view>
<text>
体重
</text>
<text>
{{
data
.
weight
}}
</text>
</view>
<view>
<text>
手机号码
</text>
<text>
{{
data
.
mobile
}}
</text>
</view>
<view>
<text>
邮箱账号
</text>
<uni-link
:href=
"'mailto:'+data.email"
:text=
"data.email"
></uni-link>
</view>
<view>
<text>
个人博客
</text>
<uni-link
:href=
"data.url"
:download=
"data.url"
:text=
"data.url"
></uni-link>
</view>
<view>
<text>
喜欢的书
</text>
<text>
{{
data
.
favorite_book_id
&&
data
.
favorite_book_id
[
0
]
&&
data
.
favorite_book_id
[
0
].
title
}}
</text>
</view>
<view>
<text>
地址
</text>
<text>
{{
data
.
address_code
&&
data
.
address_code
[
0
]
&&
data
.
address_code
[
0
].
name
}}
</text>
</view>
<view>
<text>
是否为党员
</text>
<text>
{{
data
.
party_member
==
true
?
'
✅
'
:
'
❌
'
}}
</text>
</view>
<view>
<text>
业余爱好
</text>
<uni-data-picker
:localdata=
"options.hobby_valuetotext"
:value=
"data.hobby"
:multiple=
"false"
:readonly=
"true"
:arrow=
"false"
split=
","
></uni-data-picker>
</view>
<view>
<text>
备注
</text>
<text>
{{
data
.
comment
}}
</text>
</view>
</view>
</unicloud-db>
<view
class=
"btns"
>
<button
type=
"primary"
@
click=
"handleUpdate"
>
修改
</button>
<button
type=
"warn"
class=
"btn-delete"
@
click=
"handleDelete"
>
删除
</button>
</view>
</view>
</
template
>
<
script
>
// 由schema2code生成,包含校验规则和enum静态数据
import
{
enumConverter
}
from
'
../../js_sdk/validator/user-info.js
'
;
// 由schema2code生成,包含校验规则和enum静态数据
import
{
enumConverter
}
from
'
../../js_sdk/validator/user-info.js
'
;
export
default
{
data
()
{
return
{
queryWhere
:
''
,
loadMore
:
{
contentdown
:
''
,
contentrefresh
:
''
,
contentnomore
:
''
},
options
:
{
// 将scheme enum 属性静态数据中的value转成text
...
enumConverter
},
_id
:
''
}
},
onLoad
(
e
)
{
console
.
log
(
'
e:-----id
'
,
e
);
this
.
_id
=
e
.
id
},
onReady
()
{
if
(
this
.
_id
)
{
this
.
queryWhere
=
'
_id=="
'
+
this
.
_id
+
'
"
'
}
},
methods
:
{
handleUpdate
()
{
// 打开修改页面
uni
.
navigateTo
({
url
:
'
./edit?id=
'
+
this
.
_id
,
events
:
{
// 监听修改页面成功修改数据后, 刷新当前页面数据
refreshData
:
()
=>
{
this
.
$refs
.
udb
.
loadData
({
clear
:
true
})
}
}
})
},
handleDelete
()
{
this
.
$refs
.
udb
.
remove
(
this
.
_id
,
{
success
:
(
res
)
=>
{
// 删除数据成功后跳转到list页面
uni
.
navigateTo
({
url
:
'
./list
'
})
}
})
}
}
}
export
default
{
data
()
{
return
{
queryWhere
:
''
,
loadMore
:
{
contentdown
:
''
,
contentrefresh
:
''
,
contentnomore
:
''
},
options
:
{
// 将scheme enum 属性静态数据中的value转成text
...
enumConverter
},
_id
:
''
}
},
onLoad
(
e
)
{
console
.
log
(
'
e:-----id
'
,
e
);
this
.
_id
=
e
.
id
},
onReady
()
{
if
(
this
.
_id
)
{
this
.
queryWhere
=
'
_id=="
'
+
this
.
_id
+
'
"
'
}
},
methods
:
{
handleUpdate
()
{
// 打开修改页面
uni
.
navigateTo
({
url
:
'
./edit?id=
'
+
this
.
_id
,
events
:
{
// 监听修改页面成功修改数据后, 刷新当前页面数据
refreshData
:
()
=>
{
this
.
$refs
.
udb
.
loadData
({
clear
:
true
})
}
}
})
},
handleDelete
()
{
console
.
log
(
'
handleDelete:-----
'
);
this
.
$refs
.
udb
.
remove
(
this
.
_id
,
{
success
:
(
res
)
=>
{
console
.
log
(
'
res:-----
'
,
res
);
// 删除数据成功后跳转到list页面
uni
.
navigateTo
({
url
:
'
./list
'
})
},
fail
:
(
err
)
=>
{
console
.
log
(
'
err:-----
'
,
err
);
uni
.
showToast
({
title
:
'
删除失败
'
,
icon
:
'
none
'
})
}
})
}
}
}
</
script
>
<
style
>
.container
{
padding
:
10px
;
}
.container
{
padding
:
10px
;
}
.btns
{
margin-top
:
10px
;
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
}
.btns
{
margin-top
:
10px
;
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
}
.btns
button
{
flex
:
1
;
}
.btns
button
{
flex
:
1
;
}
.btn-delete
{
margin-left
:
10px
;
}
</
style
>
.btn-delete
{
margin-left
:
10px
;
}
</
style
>
\ No newline at end of file
pages/user-info/edit.test.js
浏览文件 @
e4d06020
...
...
@@ -31,5 +31,6 @@ describe('pages/user-info/detail.vue', () => {
console
.
log
(
'
res:
'
,
res
.
updated
);
expect
(
res
.
updated
).
toBe
(
1
)
}
console
.
log
(
"
currentPage
"
,
await
program
.
currentPage
())
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录