Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
9a102b75
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
9a102b75
编写于
4月 17, 2024
作者:
dcloud_wdl
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into alpha
上级
ded8f885
3b36e923
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
169 addition
and
28 deletion
+169
-28
pages/index/basicTest.test.js
pages/index/basicTest.test.js
+34
-25
pages/index/basicTest.uvue
pages/index/basicTest.uvue
+12
-2
uni_modules/uts-ios-tests/changelog.md
uni_modules/uts-ios-tests/changelog.md
+0
-0
uni_modules/uts-ios-tests/package.json
uni_modules/uts-ios-tests/package.json
+82
-0
uni_modules/uts-ios-tests/readme.md
uni_modules/uts-ios-tests/readme.md
+6
-0
uni_modules/uts-ios-tests/utssdk/app-js/index.uts
uni_modules/uts-ios-tests/utssdk/app-js/index.uts
+9
-0
uni_modules/uts-ios-tests/utssdk/interface.uts
uni_modules/uts-ios-tests/utssdk/interface.uts
+3
-0
uni_modules/uts-tests/utssdk/Date.uts
uni_modules/uts-tests/utssdk/Date.uts
+23
-1
未找到文件。
pages/index/basicTest.test.js
浏览文件 @
9a102b75
...
@@ -3,35 +3,44 @@ const ERR_RE = /expected:<(.*)> but was:<(.*)>/
...
@@ -3,35 +3,44 @@ const ERR_RE = /expected:<(.*)> but was:<(.*)>/
let
result
;
let
result
;
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
await
program
.
reLaunch
(
'
/pages/index/basicTest
'
)
await
program
.
reLaunch
(
'
/pages/index/basicTest
'
)
page
=
await
program
.
currentPage
()
page
=
await
program
.
currentPage
()
await
page
.
waitFor
(
3000
);
await
page
.
waitFor
(
3000
);
const
data
=
await
page
.
data
();
const
data
=
await
page
.
data
();
result
=
data
[
'
result
'
]
result
=
data
[
'
result
'
]
})
})
function
getApiFailed
(
describe
,
api
)
{
function
getApiFailed
(
describe
,
api
)
{
const
failed
=
result
[
describe
]?.
failed
?.
find
(
item
=>
{
const
failed
=
result
[
describe
]?.
failed
?.
find
(
item
=>
{
return
item
.
split
(
'
:
'
)[
0
]
===
api
return
item
.
split
(
'
:
'
)[
0
]
===
api
})
})
return
failed
return
failed
}
}
describes
.
forEach
(
d
=>
{
describes
.
forEach
(
d
=>
{
d
?.
describe
&&
describe
(
d
.
describe
,
()
=>
{
d
?.
describe
&&
describe
(
d
.
describe
,
()
=>
{
d
?.
tests
&&
d
.
tests
.
forEach
(
api
=>
{
d
?.
tests
&&
d
.
tests
.
forEach
(
api
=>
{
it
(
api
,
()
=>
{
it
(
api
,
()
=>
{
const
failed
=
getApiFailed
(
d
.
describe
,
api
)
const
failed
=
getApiFailed
(
d
.
describe
,
api
)
if
(
failed
)
{
if
(
failed
)
{
const
parts
=
failed
.
split
(
'
\n
'
)
const
parts
=
failed
.
split
(
'
\n
'
)
const
matches
=
parts
[
1
].
match
(
ERR_RE
)
const
matches
=
parts
[
1
].
match
(
ERR_RE
)
if
(
matches
?.
length
)
{
if
(
matches
?.
length
)
{
expect
(
matches
[
2
]).
toEqual
(
matches
[
1
])
expect
(
matches
[
2
]).
toEqual
(
matches
[
1
])
}
else
{
}
else
{
expect
(
parts
[
1
]).
toEqual
(
''
)
expect
(
parts
[
1
]).
toEqual
(
''
)
}
}
}
}
})
})
})
})
})
})
})
})
if
(
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
describe
(
'
testTypeFromAppJs
'
,
()
=>
{
it
(
"
jest_testTypeFromAppJs
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_testTypeFromAppJs
'
)
expect
(
res
).
toEqual
(
true
)
})
})
}
\ No newline at end of file
pages/index/basicTest.uvue
浏览文件 @
9a102b75
...
@@ -20,7 +20,10 @@
...
@@ -20,7 +20,10 @@
<!-- #endif -->
<!-- #endif -->
</template>
</template>
<script lang="ts">
<script lang="ts">
import { runTests, Result } from '../../uni_modules/uts-tests'
import { runTests, Result } from '../../uni_modules/uts-tests'
// #ifdef APP-IOS
import { testTypeFromAppJs, Options } from '@/uni_modules/uts-ios-tests'
// #endif
export default {
export default {
data() {
data() {
return {
return {
...
@@ -46,7 +49,14 @@ export default {
...
@@ -46,7 +49,14 @@ export default {
this.names.push(key)
this.names.push(key)
this.resultArray.push(resultMap[key] as Result)
this.resultArray.push(resultMap[key] as Result)
}
}
},
},
// #ifdef APP-IOS
jest_testTypeFromAppJs() {
return testTypeFromAppJs({
num: 1
} as Options)
}
// #endif
},
},
}
}
</script>
</script>
...
...
uni_modules/uts-ios-tests/changelog.md
0 → 100644
浏览文件 @
9a102b75
uni_modules/uts-ios-tests/package.json
0 → 100644
浏览文件 @
9a102b75
{
"id"
:
"uts-ios-tests"
,
"displayName"
:
"uts-ios-tests"
,
"version"
:
"1.0.0"
,
"description"
:
"uts-ios-tests"
,
"keywords"
:
[
"uts-ios-tests"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
,
"alipay"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
\ No newline at end of file
uni_modules/uts-ios-tests/readme.md
0 → 100644
浏览文件 @
9a102b75
# uts-ios-tests
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
\ No newline at end of file
uni_modules/uts-ios-tests/utssdk/app-js/index.uts
0 → 100644
浏览文件 @
9a102b75
import { Options } from '../interface.uts';
export function testTypeFromAppJs(options : Options) {
return options instanceof Options
}
export {
Options
}
\ No newline at end of file
uni_modules/uts-ios-tests/utssdk/interface.uts
0 → 100644
浏览文件 @
9a102b75
export type Options = {
num: number
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/Date.uts
浏览文件 @
9a102b75
...
@@ -44,7 +44,29 @@ export function testDate() : Result {
...
@@ -44,7 +44,29 @@ export function testDate() : Result {
// expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800");
// expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800");
// expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800");
// expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800");
// // #endif
// // #endif
})
})
test('toXString', () => {
const event = new Date('1995-12-17T03:24:00');
// #ifndef APP-ANDROID
expect(event.toString()).toEqual("Sun Dec 17 1995 03:24:00 GMT+0800");
expect(event.toTimeString()).toEqual("03:24:00 GMT+0800");
// #endif
expect(event.toISOString()).toEqual("1995-12-16T19:24:00.000Z");
expect(event.toJSON()).toEqual("1995-12-16T19:24:00.000Z");
expect(event.toDateString()).toEqual("Sun Dec 17 1995");
const event2 = new Date('2014-01-09 22:00:00');
// #ifndef APP-ANDROID
expect(event2.toString()).toEqual("Thu Jan 09 2014 22:00:00 GMT+0800");
expect(event2.toTimeString()).toEqual("2014-01-09T14:00:00.000Z");
// #endif
expect(event2.toISOString()).toEqual("2014-01-09T14:00:00.000Z");
expect(event2.toJSON()).toEqual("Thu Jan 09 2014");
expect(event2.toDateString()).toEqual("22:00:00 GMT+0800");
})
test('getDate', () => {
test('getDate', () => {
const birthday = new Date('August 19, 1975 23:15:30');
const birthday = new Date('August 19, 1975 23:15:30');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录