UNPKG

@juzi/wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

18 lines 867 B
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm import { test } from 'tstest'; import { isWechatified, wechatifyMixin, wechatifyUserModule, } from './wechatify.js'; const wechaty = { puppet: {}, }; test('isWechatified()', async (t) => { class UserClassTest extends wechatifyMixin(Object) { } t.notOk(isWechatified(UserClassTest), 'should not be wechatified'); t.throws(() => UserClassTest.wechaty, 'should throw before wechatified'); const WechatifiedUserClass = wechatifyUserModule(UserClassTest)(wechaty); t.ok(isWechatified(WechatifiedUserClass), 'should be wechatified'); t.doesNotThrow(() => WechatifiedUserClass.wechaty, 'should not throw after wechatified'); const user = new WechatifiedUserClass(); t.ok(user, 'should be able to assign with the correct typing'); }); //# sourceMappingURL=wechatify.spec.js.map