Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.Veneno.
wechaty
提交
0fdca19f
W
wechaty
项目概览
.Veneno.
/
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,发现更多精彩内容 >>
提交
0fdca19f
编写于
6月 12, 2018
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename Bridge to Manager
上级
d3e342c7
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
143 addition
and
81 deletion
+143
-81
src/puppet-padchat/padchat-manager.spec.ts
src/puppet-padchat/padchat-manager.spec.ts
+61
-0
src/puppet-padchat/padchat-manager.ts
src/puppet-padchat/padchat-manager.ts
+77
-76
src/puppet-padchat/puppet-padchat.ts
src/puppet-padchat/puppet-padchat.ts
+5
-5
未找到文件。
src/puppet-padchat/padchat-manager.spec.ts
0 → 100755
浏览文件 @
0fdca19f
#!/usr/bin/env ts-node
// tslint:disable:no-shadowed-variable
import
test
from
'
blue-tape
'
import
{
MemoryCard
}
from
'
memory-card
'
import
{
Bridge
}
from
'
./bridge
'
import
{
WECHATY_PUPPET_PADCHAT_ENDPOINT
,
}
from
'
./config
'
class
BridgeTest
extends
Bridge
{
public
async
initCache
(
token
:
string
,
selfId
:
string
)
{
return
super
.
initCache
(
token
,
selfId
,
)
}
public
async
releaseCache
()
{
return
super
.
releaseCache
()
}
}
test
(
'
smoke testing
'
,
async
t
=>
{
t
.
skip
(
'
tbw
'
)
})
test
(
'
bridge cache should be release and can be re-init again.
'
,
async
t
=>
{
const
bridge
=
new
BridgeTest
({
memory
:
new
MemoryCard
(),
token
:
'
mock token
'
,
endpoint
:
WECHATY_PUPPET_PADCHAT_ENDPOINT
,
})
try
{
await
bridge
.
initCache
(
'
fake-token
'
,
'
fake-self-id
'
)
await
bridge
.
releaseCache
()
await
bridge
.
initCache
(
'
fake-token
'
,
'
fake-self-id
'
)
t
.
pass
(
'
bridge cache init/release/init successed.
'
)
}
catch
(
e
)
{
t
.
fail
(
e
)
}
})
test
(
'
bridge should can be restart() after a start()
'
,
async
t
=>
{
const
bridge
=
new
Bridge
({
memory
:
new
MemoryCard
(),
token
:
'
mock token
'
,
endpoint
:
WECHATY_PUPPET_PADCHAT_ENDPOINT
,
})
try
{
await
bridge
.
start
()
await
bridge
.
stop
()
await
bridge
.
start
()
t
.
pass
(
'
bridge start/restart successed.
'
)
}
catch
(
e
)
{
t
.
fail
(
e
)
}
})
src/puppet-padchat/
bridge
.ts
→
src/puppet-padchat/
padchat-manager
.ts
浏览文件 @
0fdca19f
此差异已折叠。
点击以展开。
src/puppet-padchat/puppet-padchat.ts
浏览文件 @
0fdca19f
...
...
@@ -69,10 +69,10 @@ import {
}
from
'
./config
'
import
{
Bridge
,
PadchatManager
,
// resolverDict,
// AutoDataType,
}
from
'
./
bridge
'
}
from
'
./
padchat-manager
'
import
{
// PadchatPayload,
...
...
@@ -104,7 +104,7 @@ export class PuppetPadchat extends Puppet {
private
readonly
cachePadchatMessagePayload
:
LRU
.
Cache
<
string
,
PadchatMessagePayload
>
// private readonly cachePadchatRoomPayload : LRU.Cache<string, PadchatRoomRawPayload>
public
bridge
?:
Bridge
public
bridge
?:
PadchatManager
constructor
(
public
options
:
PuppetOptions
,
...
...
@@ -187,7 +187,7 @@ export class PuppetPadchat extends Puppet {
*/
this
.
state
.
on
(
'
pending
'
)
const
bridge
=
this
.
bridge
=
new
Bridge
({
const
bridge
=
this
.
bridge
=
new
PadchatManager
({
memory
:
this
.
options
.
memory
,
token
:
padchatToken
(),
endpoint
:
WECHATY_PUPPET_PADCHAT_ENDPOINT
,
...
...
@@ -208,7 +208,7 @@ export class PuppetPadchat extends Puppet {
this
.
bridge
.
syncContactsAndRooms
()
}
public
async
startBridge
(
bridge
:
Bridge
):
Promise
<
void
>
{
public
async
startBridge
(
bridge
:
PadchatManager
):
Promise
<
void
>
{
log
.
verbose
(
'
PuppetPadchat
'
,
'
startBridge()
'
)
if
(
this
.
state
.
off
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录