UNPKG

@juzi/wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

20 lines 1.01 kB
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tstest_1 = require("tstest"); const wechatify_js_1 = require("./wechatify.js"); const wechaty = { puppet: {}, }; (0, tstest_1.test)('isWechatified()', async (t) => { class UserClassTest extends (0, wechatify_js_1.wechatifyMixin)(Object) { } t.notOk((0, wechatify_js_1.isWechatified)(UserClassTest), 'should not be wechatified'); t.throws(() => UserClassTest.wechaty, 'should throw before wechatified'); const WechatifiedUserClass = (0, wechatify_js_1.wechatifyUserModule)(UserClassTest)(wechaty); t.ok((0, wechatify_js_1.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