# TESTS
Run unit tests
```shell
$ npm test
...
```
If you want to see full log messages
```shell
$ WECHATY_LOG=silly npm test
...
```
## EXAMPLE OUTPUT
```bash
> wechaty@0.17.11 test /home/zixia/chatie/wechaty
> npm run clean && npm run lint && npm run test:unit:retry && npm run test:shell && npm run sloc
> wechaty@0.17.11 clean /home/zixia/chatie/wechaty
> shx rm -fr dist/*
> wechaty@0.17.11 lint /home/zixia/chatie/wechaty
> npm run check-node-version && npm run lint:ts && npm run lint:es && npm run lint:sh
> wechaty@0.17.11 check-node-version /home/zixia/chatie/wechaty
> check-node-version --node ">= 8.5"
> wechaty@0.17.11 lint:ts /home/zixia/chatie/wechaty
> tslint --project tsconfig.json && tsc --noEmit
> wechaty@0.17.11 lint:es /home/zixia/chatie/wechaty
> eslint "{bin,examples,scripts,src,tests}/**/*.js" --ignore-pattern="tests/fixtures/**"
> wechaty@0.17.11 lint:sh /home/zixia/chatie/wechaty
> bash -n bin/*.sh
> wechaty@0.17.11 test:unit:retry /home/zixia/chatie/wechaty
> ts-node scripts/retry-unit-tests
Safe Test: starting...
Safe Test: running for round #0
> wechaty@0.17.11 test:unit /home/zixia/chatie/wechaty
> TS_NODE_FILES=1 tap --node-arg=--require=ts-node/register "src/**/*.spec.ts" "src/*.spec.ts" "tests/*.spec.ts" "tests/**/*.spec.ts"
TAP version 13
# Accessory smoke testing
ok 1 should throw if read static puppet before initialize
ok 2 should throw if read instance puppet before initialization
ok 3 should get EXPECTED_PUPPET1 from static puppet after set static puppet
ok 4 should get EXPECTED_PUPPET1 from instance puppet after set static puppet
# Two clone-ed classes have different static puppet value
ok 5 should get the puppet as 1 from 1st cloned class
ok 6 should get the puppet as 2 from 2nd cloned class
# Throw error when set the value again
ok 7 instance: should not throw when set at 1st time
ok 8 instance: should throw when set at 2nd time
ok 9 static: should not throw when set at 1st time
ok 10 static: should throw when set at 2nd time
# important variables
ok 11 should exist `puppet` in Config
ok 12 should exist `apihost` in Config
ok 13 should exist `profile` in Config
ok 14 should exist `token` in Config
ok 15 should export DEFAULT_PUPPET
ok 16 should export DEFAULT_PROFILE
ok 17 should export DEFAULT_PROTOCOL
ok 18 should export DEFAULT_APIHOST
# validApiHost()
ok 19 should not throw
ok 20 should not throw
ok 21 should throw
ok 22 should throw
# Io restart without problem
ok 23 start/stop-ed at #0
ok 24 start/stop-ed at #1
ok 25 start/restart successed.
# stripHtml()
ok 26 should strip html as expected
# unescapeHtml()
ok 27 should unescape html as expected
# plainText()
ok 28 should convert plain text as expected
# digestEmoji()
ok 29 should digest emoji string 0 as expected
ok 30 should digest emoji string 1 as expected
ok 31 should digest emoji string 2 as expected
ok 32 should digest emoji string 3 as expected
# unifyEmoji()
ok 33 should convert the emoji xml to the expected unified xml
ok 34 should convert the emoji xml to the expected unified xml
# stripEmoji()
ok 35 should strip to the expected str
ok 36 should strip to the expected str
ok 37 should return empty string for `undefined`
# downloadStream() for media
ok 38 should has cookies in req
ok 39 should has a cookie named life value 42
ok 40 should success download dong from downloadStream()
# getPort() for an available socket port
ok 41 should not be same port even it is available(to provent conflict between concurrency tests in AVA)
ok 42 should has no exception after loop test
# promiseRetry()
ok 43 should got EXPECTED_REJECT when wait not enough
ok 44 should got EXPECTED_RESOLVE when wait enough
# retry()
ok 45 should got EXPECTED_RESOLVE when wait enough
# PuppetMock restart without problem
ok 46 start/stop-ed at #0
ok 47 start/stop-ed at #1
ok 48 start/stop-ed at #2
ok 49 PuppetMock() start/restart successed.
# PadchatManager() cache should be release and can be re-init again.
ok 50 init/release-ed at #0
ok 51 init/release-ed at #1
ok 52 init/release-ed at #2
ok 53 PadchatManager() cache init/release/init successed.
# PadchatManager() cache release 10 instances for the same time
ok 54 release 10 at the same time success
# PadchatManager() should can be able to restart() many times for one instance
ok 55 restarted at #0
ok 56 restarted at #1
ok 57 restarted at #2
ok 58 PadchatManager() restart successed.
# PadchatManager() stop many instances for the same time
ok 59 stop3 at the same time success
# PuppetPadchat() throw exception when instanciate the second instance without options.token
ok 60 should instance the 1st puppet without problem
ok 61 should throw when instance the 2nd instance without the token option
ok 62 should instance the 3rd puppet with token option
# stripBugChatroomId()
ok 63 should return pure user_name for RAW_USER_NAME_1
ok 64 should return pure user_name for RAW_USER_NAME_2
ok 65 should return empty string for undifined
# contactRawPayloadParser
ok 66 should parse ContactPayload for personal account payload
ok 67 should parse ContactPayload for official account payload
ok 68 should throw exception for invalid object
ok 69 should throw exception for undifined
# imageBase64ToQrCode()
ok 70 should decode qrcode image base64
# friendshipConfirmEventMessageParser() EN-confirm-by-other
ok 71 should parse message to contact id
# friendshipConfirmEventMessageParser() EN-confirm-by-bot
ok 72 should parse message to contact id
# friendshipConfirmEventMessageParser() ZH-confirm-by-other
ok 73 tbw # SKIP
# friendshipConfirmEventMessageParser() ZH-confirm-by-bot
ok 74 should parse message to contact id
# friendshipReceiveEventMessageParser()
ok 75 should parse message to receive contact id
# friendshipConfirmEventMessageParser()
ok 76 should parse `undefined`
ok 77 should parse `null`
ok 78 should parse `{}`
ok 79 should parse invalid content
# friendshipReceiveEventMessageParser()
ok 80 should parse `undefined`
ok 81 should parse `null`
ok 82 should parse `{}`
ok 83 should parse invalid content
# friendshipVerifyEventMessageParser()
ok 84 should parse `undefined`
ok 85 should parse `null`
ok 86 should parse `{}`
ok 87 should parse invalid content
# friendshipVerifyEventMessageParser() EN
ok 88 should parse verify message to contact id
# friendshipVerifyEventMessageParser() ZH
ok 89 should parse verify message to contact id
# friendshipRawPayloadParser()
ok 90 should parse friendshipPayload right
# isRoomId()
ok 91 should return true for ROOM_ID
ok 92 should return false for ROOM_ID
ok 93 should return false for undifined
# isContactId()
ok 94 should return true for CONTACT_ID
ok 95 should return false for CONTACT_ID
ok 96 should return false for undifined
# isContactOfficialId()
ok 97 should return true for OFFICIAL_CONTACT_ID
ok 98 should return false for NOT_OFFICIAL_CONTACT_ID
ok 99 should return false for undifined
# isStrangerV1()
ok 100 should return true for STRANGER_V1
ok 101 should return false for NOT_STRANGER_V1
# isStrangerV2()
ok 102 should return true for STRANGER_V2
ok 103 should return false for NOT_STRANGER_V2
# isPayload()
ok 104 undefined is not payload
ok 105 null is not payload
ok 106 {} is not payload
ok 107 valid payload
# messageRawPayloadParser
ok 108 tbw # SKIP
# sys
ok 109 should parse sys message payload
# status notify
ok 110 should parse status notify message payload
# room invitation created by bot
ok 111 should parse room invitation message payload
# room ownership transfer message
ok 112 should parse ower transfer message
# StatusNotify to roomId
ok 113 should parse status notify message to room id
# share card peer to peer
ok 114 should parse share card message peer to peer
# share card in room
ok 115 should parse share card message peer to peer
# padchatDecode() uri decode with +
ok 116 should parse json text with "+" right
# padchatDecode() plain json text
ok 117 should decode invalid uridecode text
# roomJoinEventMessageParser() EN-other-invite-other
ok 118 should parse event
# roo
没有合适的资源?快使用搜索试试~ 我知道了~
聊天机器人制造商的对话式 RPA SDK_TypeScript_代码_下载
共198个文件
ts:120个
md:12个
json:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 19 浏览量
2022-06-18
16:01:18
上传
评论 1
收藏 637KB ZIP 举报
温馨提示
Wechaty 是一个用于聊天机器人制造商的 RPA(机器人流程自动化)SDK,它可以帮助您在 6 行JavaScript、Python、Go和Java中创建机器人,并具有跨平台支持,包括Linux、Windows、MacOS和Docker。
资源推荐
资源详情
资源评论
收起资源包目录
聊天机器人制造商的对话式 RPA SDK_TypeScript_代码_下载 (198个子文件)
Dockerfile.alpine 3KB
AUTHORS 112B
docker.bats 2KB
.eslintrc.cjs 104B
with-require.cjs 103B
CODEOWNERS 82B
Dockerfile 3KB
.dockerignore 49B
.editorconfig 327B
screenshot-ding-dong-bot-win32-qrcode.gif 39KB
.gitignore 970B
qrcode_for_chatie.jpg 27KB
clean-json.js 254B
with-require-error.js 131B
js-bot.js 109B
es6-import.js 88B
syntax-error.js 33B
package.json 6KB
settings.json 3KB
wechat.wechaty.json 1KB
app.json 813B
tsconfig.json 364B
qq.wechaty.json 343B
package.json 302B
.markdownlint.json 287B
tsconfig.cjs.json 116B
package.json 23B
package.json 21B
LICENSE 11KB
CHANGELOG.md 111KB
README.md 109KB
index.md 77KB
README.md 36KB
CODE_OF_CONDUCT.md 5KB
CONTRIBUTING.md 3KB
wechaty-bug-report.md 2KB
DEVELOPMENT.md 936B
wechaty-feature-request.md 580B
PULL_REQUEST_TEMPLATE.md 436B
README.md 333B
wechaty-question.md 309B
NOTICE 328B
.nycrc 45B
Dockerfile.onbuild 345B
bot-qr-code.png 129KB
blessed-twins-bot.png 106KB
wechaty-logo-green-en.png 40KB
wechaty-logo-green-en-transparent.png 23KB
wechaty-logo-en.png 13KB
wechaty-logo-zh.png 8KB
wechaty-icon.png 5KB
wechaty-white-transparent.png 2KB
wechaty-icon-green.png 2KB
entrypoint.sh 7KB
docker.sh 3KB
npm-pack-testing.sh 1KB
generate-docs.sh 1KB
npm-deprecate-version.sh 711B
generate-package-json.sh 542B
install-chrome-linux.sh 417B
package-publish-config-tag.sh 347B
typedoc.sh 292B
npm-set-latest.sh 234B
git-push-tag.sh 133B
friday-qrcode.svg 15KB
wechaty-banner.svg 7KB
wechaty-banner-white.svg 7KB
room.ts 39KB
message.ts 32KB
contact.ts 24KB
puppet-mixin.ts 17KB
io.ts 16KB
post.ts 13KB
wechaty-events.ts 12KB
friendship.ts 12KB
wechaty-base.spec.ts 11KB
wechaty-base.ts 10KB
room-invitation.ts 8KB
io-client.ts 7KB
contact-self.ts 6KB
gateway.ts 6KB
wechatify-user-module-mixin.ts 6KB
tag.ts 6KB
room.spec.ts 6KB
update-license.ts 5KB
ding-dong-bot.ts 5KB
room-events.ts 5KB
config.ts 5KB
puppet-config.ts 4KB
message.spec.ts 4KB
wechaty-impl.spec.ts 4KB
xml.spec.ts 4KB
sort-contributiveness.ts 4KB
url-link.ts 4KB
mod.ts 4KB
wechaty-builder.ts 3KB
wechaty-skeleton.ts 3KB
config.spec.ts 3KB
login-mixin.ts 3KB
impls.ts 3KB
共 198 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功