@juzi/wechaty
Version:
Wechaty is a RPA SDK for Chatbot Makers.
89 lines • 3.76 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Wechaty Chatbot SDK - https://github.com/wechaty/wechaty
*
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
* Wechaty Contributors <https://github.com/wechaty>.
*
* 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.
*
*/
const tstest_1 = require("tstest");
const PUPPET = __importStar(require("@juzi/wechaty-puppet"));
const wechaty_puppet_mock_1 = __importDefault(require("@juzi/wechaty-puppet-mock"));
const file_box_1 = require("file-box");
const wechaty_builder_js_1 = require("../wechaty-builder.js");
tstest_1.test.skip('Post smoke testing', async (t) => {
void tstest_1.sinon;
const puppet = new wechaty_puppet_mock_1.default();
const wechaty = wechaty_builder_js_1.WechatyBuilder.build({ puppet });
await wechaty.start();
const bot = puppet.mocker.createContact({ name: 'Bot' });
puppet.mocker.login(bot);
const post = await wechaty.Post.builder()
.add('Hello, world!')
.add(file_box_1.FileBox.fromQRCode('qr'))
.add(await wechaty.UrlLink.create('https://yahoo.com'))
.build();
await wechaty.say(post);
await post.reply('Thanks for sharing!');
await post.like(true);
await post.tap(PUPPET.types.Tap.Like, false);
const pagination = {
pageSize: 10,
pageToken: '',
};
for await (const sayable of post) {
t.ok(sayable, 'tbw');
}
for await (const descendantPost of post.descendants()) {
t.ok(descendantPost, 'tbw');
}
const [descendantList, _nextPageToken2] = await wechaty.Post.findAll({}, pagination);
t.ok(descendantList, 'tbw');
for await (const liker of post.taps({ type: PUPPET.types.Tap.Like })) {
t.ok(liker, 'tbw');
}
const [tapList, _nextPageToken3] = await post.tapFind({ type: PUPPET.types.Tap.Like }, pagination);
t.ok(tapList, 'tbw');
await wechaty.stop();
});
//# sourceMappingURL=post.spec.js.map