wechaty.spec.ts 1.9 KB
Newer Older
1
/**
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
2
 *   Wechaty - https://github.com/chatie/wechaty
3
 *
4
 *   @copyright 2016-2017 Huan LI <zixia@zixia.net>
5 6 7 8 9 10 11 12 13 14 15 16
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
17 18
 *
 */
19 20 21
import { test } from 'ava'

import {
22
  config,
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
23 24 25 26 27 28 29 30
  Contact,
  FriendRequest,
  IoClient,
  Message,
  Puppet,
  PuppetWeb,
  Room,
  Wechaty,
31

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
32 33
  log,
  VERSION,
34
}               from '../'
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
35

36
test('Wechaty Framework', t => {
37 38 39 40 41 42 43 44 45
  t.truthy(Contact      , 'should export Contact')
  t.truthy(FriendRequest, 'should export FriendREquest')
  t.truthy(IoClient     , 'should export IoClient')
  t.truthy(Message      , 'should export Message')
  t.truthy(Puppet       , 'should export Puppet')
  t.truthy(PuppetWeb    , 'should export PuppetWeb')
  t.truthy(Room         , 'should export Room')
  t.truthy(Wechaty      , 'should export Wechaty')
  t.truthy(log          , 'should export log')
46

47
  const bot = Wechaty.instance()
L
lijiarui 已提交
48 49
  t.is(bot.version(true), require('../package.json').version,
                          'should return version as the same in package.json',
50
  )
L
lijiarui 已提交
51 52
  t.is(VERSION, require('../package.json').version,
                  'should export version in package.json',
53
  )
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
54
})
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
55

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
56
test('Wechaty Config setting', t => {
57 58 59 60
  t.truthy(config                 , 'should export Config')
  t.truthy(config.DEFAULT_HEAD    , 'should has DEFAULT_HEAD')
  t.truthy(config.DEFAULT_PUPPET  , 'should has DEFAULT_PUPPET')
  t.truthy(config.DEFAULT_PORT    , 'should has DEFAULT_PORT')
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
61
})