Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
f724a150
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
351
Star
2
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f724a150
编写于
4月 28, 2024
作者:
辛宝Otto
🥊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 兼容不同平台的字段排序差异
上级
6b4c1923
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
37 deletion
+54
-37
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
...pi/reactivity/watch-post-effect/watch-post-effect.test.js
+28
-19
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
...pi/reactivity/watch-sync-effect/watch-sync-effect.test.js
+26
-18
未找到文件。
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
浏览文件 @
f724a150
...
...
@@ -106,16 +106,21 @@ describe('watchPostEffect', () => {
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
// TODO web端和安卓端JSON.stringify对属性的排序不一致
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
||
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"num":0,"str":"num: 0","bool":false,"arr":[0]}
'
)
}
else
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
}
// web端和安卓端JSON.stringify对属性的排序不一致
// 该用字符串特征判断和字符串 JSON 解析
const
watchObjRestRaw
=
await
watchObjRes
.
text
()
expect
(
watchObjRestRaw
.
startsWith
(
'
watch obj result: obj:
'
)).
toBe
(
true
)
const
stringJSON
=
watchObjRestRaw
.
split
(
'
watch obj result: obj:
'
)
expect
(
Array
.
isArray
(
stringJSON
)).
toBe
(
true
)
expect
(
stringJSON
.
length
).
toBe
(
2
)
expect
(
JSON
.
parse
(
stringJSON
[
1
])).
toEqual
({
"
num
"
:
0
,
"
str
"
:
"
num: 0
"
,
"
bool
"
:
false
,
"
arr
"
:
[
0
]
})
const
watchObjStrRes
=
await
page
.
$
(
'
#watch-obj-str-res
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 0, obj.str ref text: obj.str: num: 0
'
)
...
...
@@ -135,15 +140,19 @@ describe('watchPostEffect', () => {
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0,1]
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
||
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"num":1,"str":"num: 1","bool":true,"arr":[0,1]}
'
)
}
else
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0,1],"bool":true,"num":1,"str":"num: 1"}
'
)
}
const
watchObjRestRaw2
=
await
watchObjRes
.
text
()
expect
(
watchObjRestRaw2
.
startsWith
(
'
watch obj result: obj:
'
)).
toBe
(
true
)
const
stringJSON2
=
watchObjRestRaw2
.
split
(
'
watch obj result: obj:
'
)
expect
(
Array
.
isArray
(
stringJSON2
)).
toBe
(
true
)
expect
(
stringJSON2
.
length
).
toBe
(
2
)
expect
(
JSON
.
parse
(
stringJSON2
[
1
])).
toEqual
({
"
num
"
:
1
,
"
str
"
:
"
num: 1
"
,
"
bool
"
:
true
,
"
arr
"
:
[
0
,
1
]
})
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 1, obj.str ref text: obj.str: num: 1
'
)
...
...
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
浏览文件 @
f724a150
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect
'
// 15.5 复测ok 16.4ok 17ok
describe
(
'
watchSyncEffect
'
,
()
=>
{
let
page
=
null
beforeAll
(
async
()
=>
{
...
...
@@ -106,15 +107,20 @@ describe('watchSyncEffect', () => {
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
||
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"num":0,"str":"num: 0","bool":false,"arr":[0]}
'
)
}
else
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
}
// web端和安卓端JSON.stringify对属性的排序不一致
// 该用字符串特征判断和字符串 JSON 解析
const
watchObjRestRaw
=
await
watchObjRes
.
text
()
expect
(
watchObjRestRaw
.
startsWith
(
'
watch obj result: obj:
'
)).
toBe
(
true
)
const
stringJSON
=
watchObjRestRaw
.
split
(
'
watch obj result: obj:
'
)
expect
(
Array
.
isArray
(
stringJSON
)).
toBe
(
true
)
expect
(
stringJSON
.
length
).
toBe
(
2
)
expect
(
JSON
.
parse
(
stringJSON
[
1
])).
toEqual
({
"
num
"
:
0
,
"
str
"
:
"
num: 0
"
,
"
bool
"
:
false
,
"
arr
"
:
[
0
]
})
const
watchObjStrRes
=
await
page
.
$
(
'
#watch-obj-str-res
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
...
...
@@ -135,15 +141,17 @@ describe('watchSyncEffect', () => {
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0,1]
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
||
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"num":1,"str":"num: 1","bool":true,"arr":[0,1]}
'
)
}
else
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0,1],"bool":true,"num":1,"str":"num: 1"}
'
)
}
const
watchObjRestRaw2
=
await
watchObjRes
.
text
()
expect
(
watchObjRestRaw2
.
startsWith
(
'
watch obj result: obj:
'
)).
toBe
(
true
)
const
stringJSON2
=
watchObjRestRaw2
.
split
(
'
watch obj result: obj:
'
)
expect
(
Array
.
isArray
(
stringJSON2
)).
toBe
(
true
)
expect
(
stringJSON2
.
length
).
toBe
(
2
)
expect
(
JSON
.
parse
(
stringJSON2
[
1
])).
toEqual
({
"
num
"
:
1
,
"
str
"
:
"
num: 1
"
,
"
bool
"
:
true
,
"
arr
"
:
[
0
,
1
]
})
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 1, obj.str ref text: obj.str: num: 0
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录