Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.www.
wechaty
提交
c0a69986
W
wechaty
项目概览
.www.
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0a69986
编写于
2月 06, 2017
作者:
ruiruibupt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test data
上级
39e1955a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
5 deletion
+15
-5
test/contact.spec.ts
test/contact.spec.ts
+4
-0
test/room.spec.ts
test/room.spec.ts
+11
-5
未找到文件。
test/contact.spec.ts
浏览文件 @
c0a69986
...
...
@@ -18,6 +18,7 @@ test('Contact smoke testing', async t => {
/* tslint:disable:variable-name */
const
UserName
=
'
@0bb3e4dd746fdbd4a80546aef66f4085
'
const
NickName
=
'
Nick Name Test
'
const
RemarkName
=
'
Alias Test
'
// Mock
const
mockContactGetter
=
function
(
id
)
{
...
...
@@ -27,6 +28,7 @@ test('Contact smoke testing', async t => {
return
resolve
({
UserName
:
UserName
,
NickName
:
NickName
,
RemarkName
:
RemarkName
})
},
200
)
})
...
...
@@ -38,6 +40,8 @@ test('Contact smoke testing', async t => {
const
r
=
await
c
.
ready
(
mockContactGetter
)
t
.
is
(
r
.
get
(
'
id
'
)
,
UserName
,
'
UserName set
'
)
t
.
is
(
r
.
get
(
'
name
'
)
,
NickName
,
'
NickName set
'
)
t
.
is
(
r
.
name
(),
NickName
,
'
should get the right name from Contact
'
)
t
.
is
(
r
.
alias
(),
RemarkName
,
'
should get the right alias from Contact
'
)
const
s
=
r
.
toString
()
t
.
is
(
typeof
s
,
'
string
'
,
'
toString()
'
)
...
...
test/room.spec.ts
浏览文件 @
c0a69986
...
...
@@ -109,11 +109,17 @@ test('Room smoking test', async t => {
const
contact1
=
new
Contact
(
EXPECTED
.
memberId1
)
const
nick1
=
r
.
nick
(
contact1
)
t
.
is
(
nick1
,
EXPECTED
.
memberNick1
,
'
should get nick1 from DisplayName
'
)
t
.
is
(
nick1
,
EXPECTED
.
memberNick1
,
'
should get nick1 from roomAlias
'
)
const
name1
=
r
.
name
(
contact1
)
t
.
is
(
name1
,
EXPECTED
.
memberNick1
,
'
should get name1 from roomAlias
'
)
const
contact2
=
new
Contact
(
EXPECTED
.
memberId2
)
const
nick2
=
r
.
nick
(
contact2
)
t
.
is
(
nick2
,
EXPECTED
.
memberNick2
,
'
should get nick2 from NickName because there is no DisplayName,
'
)
t
.
is
(
nick2
,
EXPECTED
.
memberNick2
,
'
should get nick2 from name because there is no roomAlias,
'
)
const
name2
=
r
.
name
(
contact2
)
t
.
is
(
name2
,
EXPECTED
.
memberNick2
,
'
should get nick2 from name because there is no roomAlias,
'
)
t
.
truthy
(
r
.
has
(
contact1
),
'
should has contact1
'
)
const
noSuchContact
=
new
Contact
(
'
not exist id
'
)
...
...
@@ -131,9 +137,9 @@ test('Room smoking test', async t => {
if
(
!
contactA
||
!
contactB
||
!
contactC
)
{
throw
new
Error
(
'
no a or b
'
)
}
t
.
is
(
contactA
.
id
,
EXPECTED
.
memberId1
,
'
should get the right id from nick 1, find member by n
ickN
ame
'
)
t
.
is
(
contactB
.
id
,
EXPECTED
.
memberId2
,
'
should get the right id from nick 2, find member by
displayName
'
)
t
.
is
(
contactC
.
id
,
EXPECTED
.
memberId3
,
'
should get the right id from nick 3, find member by
remark
'
)
t
.
is
(
contactA
.
id
,
EXPECTED
.
memberId1
,
'
should get the right id from nick 1, find member by name
'
)
t
.
is
(
contactB
.
id
,
EXPECTED
.
memberId2
,
'
should get the right id from nick 2, find member by
roomAlias
'
)
t
.
is
(
contactC
.
id
,
EXPECTED
.
memberId3
,
'
should get the right id from nick 3, find member by
alias
'
)
const
s
=
r
.
toString
()
t
.
is
(
typeof
s
,
'
string
'
,
'
toString()
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录