UNPKG

aijinkela-wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

31 lines 1.68 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 message_js_1 = require("./message.js"); const mod_js_1 = require("./mod.js"); const url_link_js_1 = require("./url-link.js"); const wechaty = { puppet: {}, }; const UrlLinkTest = (0, mod_js_1.wechatifyUserModule)(url_link_js_1.UrlLinkImpl)(wechaty); (0, tstest_1.test)('UrlLink.create() for wechaty.js.org', async (t) => { const URL = 'https://wechaty.js.org/2020/07/02/wechat-bot-in-ten-minutes'; const EXPECTED_PAYLOAD = { description: 'Conversational RPA SDK for Chatbot Makers', thumbnailUrl: 'https://wechaty.js.org/assets/contributors/luweicn/avatar.webp', title: '十分钟实现一个智能问答微信聊天机器人', url: 'https://wechaty.js.org/2020/07/02/wechat-bot-in-ten-minutes', }; const urlLink = await UrlLinkTest.create(URL); t.equal(urlLink.title(), EXPECTED_PAYLOAD.title, 'should have title'); t.equal(urlLink.description(), EXPECTED_PAYLOAD.description, 'should have description'); t.equal(urlLink.url(), EXPECTED_PAYLOAD.url, 'should have url'); t.equal(urlLink.thumbnailUrl(), EXPECTED_PAYLOAD.thumbnailUrl, 'should have thumbnailUrl'); }); (0, tstest_1.test)('UrlLink.valid()', async (t) => { const urlLink = new UrlLinkTest({}); t.ok(url_link_js_1.UrlLinkImpl.valid(urlLink), 'should pass the validation of UrlLinkImpl'); t.notOk(message_js_1.MessageImpl.valid(urlLink), 'should not pass the validation of MessageImpl'); }); //# sourceMappingURL=url-link.spec.js.map