Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46011646
wechaty
提交
b2c089c5
W
wechaty
项目概览
weixin_46011646
/
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,体验更适合开发者的 AI 搜索 >>
提交
b2c089c5
编写于
10月 04, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use Config.puppetInstance()
上级
b452b951
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
10 deletion
+19
-10
test/contact.spec.js
test/contact.spec.js
+4
-1
test/message.spec.js
test/message.spec.js
+9
-6
test/room.spec.js
test/room.spec.js
+6
-3
未找到文件。
test/contact.spec.js
浏览文件 @
b2c089c5
import
{
test
}
from
'
ava
'
import
{
Contact
,
Wechaty
,
Config
,
Puppet
,
log
}
from
'
../
'
...
...
@@ -9,7 +11,8 @@ import {
// const Puppet = require('../src/puppet')
// const log = require('../src/brolog-env')
Contact
.
attach
(
new
Puppet
())
Config
.
puppetInstance
(
new
Puppet
())
// Contact.attach()
test
(
'
Contact smoke testing
'
,
async
t
=>
{
const
UserName
=
'
@0bb3e4dd746fdbd4a80546aef66f4085
'
...
...
test/message.spec.js
浏览文件 @
b2c089c5
import
{
test
}
from
'
ava
'
import
{
Contact
,
Message
Message
,
Wechaty
,
Config
,
Contact
,
Puppet
,
log
}
from
'
../
'
...
...
@@ -13,13 +15,14 @@ import {
// const log = require('../src/brolog-env')
const
puppet
=
new
Puppet
()
Contact
.
attach
(
puppet
)
Message
.
attach
(
puppet
)
Config
.
puppetInstance
(
puppet
)
// Contact.attach(puppet)
// Message.attach(puppet)
test
(
'
Message constructor parser test
'
,
t
=>
{
// Contact.attach(new Puppet())
// Message.attach(new Puppet())
const
rawData
=
JSON
.
parse
(
'
{"MsgId":"179242112323992762","FromUserName":"@0bb3e4dd746fdbd4a80546aef66f4085","ToUserName":"@16d20edf23a3bf3bc71bb4140e91619f3ff33b4e33f7fcd25e65c1b02c7861ab","MsgType":1,"Content":"test123","Status":3,"ImgStatus":1,"CreateTime":1461652670,"VoiceLength":0,"PlayLength":0,"FileName":"","FileSize":"","MediaId":"","Url":"","AppMsgType":0,"StatusNotifyCode":0,"StatusNotifyUserName":"","RecommendInfo":{"UserName":"","NickName":"","QQNum":0,"Province":"","City":"","Content":"","Signature":"","Alias":"","Scene":0,"VerifyFlag":0,"AttrStatus":0,"Sex":0,"Ticket":"","OpCode":0},"ForwardFlag":0,"AppInfo":{"AppID":"","Type":0},"HasProductId":0,"Ticket":"","ImgHeight":0,"ImgWidth":0,"SubMsgType":0,"NewMsgId":179242112323992770,"MMPeerUserName":"@0bb3e4dd746fdbd4a80546aef66f4085","MMDigest":"test123","MMIsSend":false,"MMIsChatRoom":false,"MMUnread":true,"LocalID":"179242112323992762","ClientMsgId":"179242112323992762","MMActualContent":"test123","MMActualSender":"@0bb3e4dd746fdbd4a80546aef66f4085","MMDigestTime":"14:37","MMDisplayTime":1461652670,"MMTime":"14:37"}
'
)
const
EXPECTED
=
{
...
...
@@ -38,7 +41,7 @@ test('Message constructor parser test', t => {
})
test
(
'
Message ready() promise testing
'
,
async
t
=>
{
// must different with other rawData, because Contact class with load() will cache the result. or use Contact.resetPool()
const
rawData
=
JSON
.
parse
(
'
{"MsgId":"3009511950433684462","FromUserName":"@0748ee480711bf20af91c298a0d7dcc77c30a680c1004157386b81cf13474823","ToUserName":"@b58f91e0c5c9e841e290d862ddb63c14","MsgType":1,"Content":"哈哈","Status":3,"ImgStatus":1,"CreateTime":1462887888,"VoiceLength":0,"PlayLength":0,"FileName":"","FileSize":"","MediaId":"","Url":"","AppMsgType":0,"StatusNotifyCode":0,"StatusNotifyUserName":"","RecommendInfo":{"UserName":"","NickName":"","QQNum":0,"Province":"","City":"","Content":"","Signature":"","Alias":"","Scene":0,"VerifyFlag":0,"AttrStatus":0,"Sex":0,"Ticket":"","OpCode":0},"ForwardFlag":0,"AppInfo":{"AppID":"","Type":0},"HasProductId":0,"Ticket":"","ImgHeight":0,"ImgWidth":0,"SubMsgType":0,"NewMsgId":3009511950433684500,"MMPeerUserName":"@0748ee480711bf20af91c298a0d7dcc77c30a680c1004157386b81cf13474823","MMDigest":"哈哈","MMIsSend":false,"MMIsChatRoom":false,"MMUnread":false,"LocalID":"3009511950433684462","ClientMsgId":"3009511950433684462","MMActualContent":"哈哈","MMActualSender":"@0748ee480711bf20af91c298a0d7dcc77c30a680c1004157386b81cf13474823","MMDigestTime":"21:44","MMDisplayTime":1462887888,"MMTime":"21:44","_h":104,"_index":0,"_offsetTop":0,"$$hashKey":"098"}
'
)
...
...
test/room.spec.js
浏览文件 @
b2c089c5
import
{
test
}
from
'
ava
'
import
{
Message
,
Room
Room
,
Wechaty
,
Config
,
Message
,
Contact
,
Puppet
,
PuppetWeb
,
log
}
from
'
../
'
Room
.
attach
(
new
PuppetWeb
())
Config
.
puppetInstance
(
new
PuppetWeb
())
// Room.attach(new PuppetWeb())
test
(
'
Room smoke testing
'
,
async
t
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录