wechaty-puppet-padplus
Version:
Puppet Padplus for Wechaty
77 lines • 3.3 kB
JavaScript
;
// tslint:disable:max-line-length
// tslint:disable:no-shadowed-variable
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const blue_tape_1 = __importDefault(require("blue-tape"));
const wechaty_puppet_1 = require("wechaty-puppet");
const room_event_topic_message_parser_1 = require("./room-event-topic-message-parser");
blue_tape_1.default('roomTopicEventMessageParser() EN-other-modify-topic', (t) => __awaiter(void 0, void 0, void 0, function* () {
const MESSAGE_PAYLOAD = {
content: '"高原ོ"修改群名为“未命名”',
createTime: 1568208243261,
fromUserName: '18295482296@chatroom',
imgBuf: '',
imgStatus: 1,
l1MsgType: 5,
msgId: '4392351666543040436',
msgSource: '',
msgSourceCd: 2,
msgType: 10000,
newMsgId: 4392351666543040500,
pushContent: '',
status: 4,
toUserName: 'wxid_zovb9ol86m7l22',
uin: '2963338780',
wechatUserName: 'wxid_zovb9ol86m7l22',
};
const EXPECTED_EVENT = {
changerName: '高原ོ',
roomId: '18295482296@chatroom',
timestamp: 1568208243261,
topic: '未命名',
};
const event = room_event_topic_message_parser_1.roomTopicEventMessageParser(MESSAGE_PAYLOAD);
t.deepEqual(event, EXPECTED_EVENT, 'should parse event');
}));
blue_tape_1.default('roomTopicEventMessageParser() EN-bot-modify-topic', (t) => __awaiter(void 0, void 0, void 0, function* () {
const MESSAGE_PAYLOAD = {
content: '你修改群名为“命名了”',
createTime: 1568208437265,
fromUserName: '18295482296@chatroom',
imgBuf: '',
imgStatus: 1,
l1MsgType: 5,
msgId: '3567919101394598675',
msgSource: '',
msgSourceCd: 2,
msgType: 10000,
newMsgId: 3567919101394599000,
pushContent: '',
status: 4,
toUserName: 'wxid_zovb9ol86m7l22',
uin: '2963338780',
wechatUserName: 'wxid_zovb9ol86m7l22',
};
const EXPECTED_EVENT = {
changerName: wechaty_puppet_1.YOU,
roomId: '18295482296@chatroom',
timestamp: 1568208437265,
topic: '命名了',
};
const event = room_event_topic_message_parser_1.roomTopicEventMessageParser(MESSAGE_PAYLOAD);
t.deepEqual(event, EXPECTED_EVENT, 'should parse event');
}));
//# sourceMappingURL=room-event-topic-message-parser.en.spec.js.map