bottender-compose
Version:
An utility library for bottender and higher-order handlers
355 lines (353 loc) • 13.7 kB
JavaScript
;
const B = require('..');
it('should export common methods', () => {
expect(B.setState).toBeDefined();
expect(B.resetState).toBeDefined();
expect(B.typing).toBeDefined();
});
it('should export Messenger methods', () => {
expect(B.sendMessage).toBeDefined();
expect(B.sendText).toBeDefined();
expect(B.sendAttachment).toBeDefined();
expect(B.sendAudio).toBeDefined();
expect(B.sendImage).toBeDefined();
expect(B.sendVideo).toBeDefined();
expect(B.sendFile).toBeDefined();
expect(B.sendTemplate).toBeDefined();
expect(B.sendButtonTemplate).toBeDefined();
expect(B.sendGenericTemplate).toBeDefined();
expect(B.sendListTemplate).toBeDefined();
expect(B.sendOpenGraphTemplate).toBeDefined();
expect(B.sendMediaTemplate).toBeDefined();
expect(B.sendReceiptTemplate).toBeDefined();
expect(B.sendAirlineBoardingPassTemplate).toBeDefined();
expect(B.sendAirlineCheckinTemplate).toBeDefined();
expect(B.sendAirlineItineraryTemplate).toBeDefined();
expect(B.sendAirlineUpdateTemplate).toBeDefined();
expect(B.sendSenderAction).toBeDefined();
expect(B.markSeen).toBeDefined();
expect(B.typingOn).toBeDefined();
expect(B.typingOff).toBeDefined();
expect(B.passThreadControl).toBeDefined();
expect(B.passThreadControlToPageInbox).toBeDefined();
expect(B.takeThreadControl).toBeDefined();
expect(B.requestThreadControl).toBeDefined();
expect(B.associateLabel).toBeDefined();
expect(B.dissociateLabel).toBeDefined();
});
it('should export Messenger predicates', () => {
expect(B.isMessage).toBeDefined();
expect(B.isText).toBeDefined();
expect(B.hasAttachment).toBeDefined();
expect(B.isImage).toBeDefined();
expect(B.isAudio).toBeDefined();
expect(B.isVideo).toBeDefined();
expect(B.isLocation).toBeDefined();
expect(B.isFile).toBeDefined();
expect(B.isFallback).toBeDefined();
expect(B.isSticker).toBeDefined();
expect(B.isLikeSticker).toBeDefined();
expect(B.isQuickReply).toBeDefined();
expect(B.isEcho).toBeDefined();
expect(B.isPostback).toBeDefined();
expect(B.isGamePlay).toBeDefined();
expect(B.isOptin).toBeDefined();
expect(B.isPayment).toBeDefined();
expect(B.isCheckoutUpdate).toBeDefined();
expect(B.isPreCheckout).toBeDefined();
expect(B.isRead).toBeDefined();
expect(B.isDelivery).toBeDefined();
expect(B.isPayload).toBeDefined();
expect(B.isPolicyEnforcement).toBeDefined();
expect(B.isAppRoles).toBeDefined();
expect(B.isStandby).toBeDefined();
expect(B.isPassThreadControl).toBeDefined();
expect(B.isTakeThreadControl).toBeDefined();
expect(B.isRequestThreadControl).toBeDefined();
expect(B.isRequestThreadControlFromPageInbox).toBeDefined();
expect(B.isFromCustomerChatPlugin).toBeDefined();
expect(B.isReferral).toBeDefined();
expect(B.isBrandedCamera).toBeDefined();
});
it('should export LINE methods', () => {
expect(B.sendText).toBeDefined();
expect(B.sendImage).toBeDefined();
expect(B.sendVideo).toBeDefined();
expect(B.sendAudio).toBeDefined();
expect(B.sendLocation).toBeDefined();
expect(B.sendSticker).toBeDefined();
expect(B.sendImagemap).toBeDefined();
expect(B.sendFlex).toBeDefined();
expect(B.sendButtonTemplate).toBeDefined();
expect(B.sendConfirmTemplate).toBeDefined();
expect(B.sendCarouselTemplate).toBeDefined();
expect(B.sendImageCarouselTemplate).toBeDefined();
expect(B.reply).toBeDefined();
expect(B.replyText).toBeDefined();
expect(B.replyImage).toBeDefined();
expect(B.replyVideo).toBeDefined();
expect(B.replyAudio).toBeDefined();
expect(B.replyLocation).toBeDefined();
expect(B.replySticker).toBeDefined();
expect(B.replyImagemap).toBeDefined();
expect(B.replyFlex).toBeDefined();
expect(B.replyButtonTemplate).toBeDefined();
expect(B.replyConfirmTemplate).toBeDefined();
expect(B.replyCarouselTemplate).toBeDefined();
expect(B.replyImageCarouselTemplate).toBeDefined();
expect(B.push).toBeDefined();
expect(B.pushText).toBeDefined();
expect(B.pushImage).toBeDefined();
expect(B.pushVideo).toBeDefined();
expect(B.pushAudio).toBeDefined();
expect(B.pushLocation).toBeDefined();
expect(B.pushSticker).toBeDefined();
expect(B.pushImagemap).toBeDefined();
expect(B.pushFlex).toBeDefined();
expect(B.pushButtonTemplate).toBeDefined();
expect(B.pushConfirmTemplate).toBeDefined();
expect(B.pushCarouselTemplate).toBeDefined();
expect(B.pushImageCarouselTemplate).toBeDefined();
expect(B.linkRichMenu).toBeDefined();
expect(B.unlinkRichMenu).toBeDefined();
});
it('should export LINE predicates', () => {
expect(B.isMessage).toBeDefined();
expect(B.isText).toBeDefined();
expect(B.isImage).toBeDefined();
expect(B.isVideo).toBeDefined();
expect(B.isAudio).toBeDefined();
expect(B.isLocation).toBeDefined();
expect(B.isSticker).toBeDefined();
expect(B.isFollow).toBeDefined();
expect(B.isUnfollow).toBeDefined();
expect(B.isJoin).toBeDefined();
expect(B.isLeave).toBeDefined();
expect(B.isPostback).toBeDefined();
expect(B.isPayload).toBeDefined();
expect(B.isBeacon).toBeDefined();
expect(B.isAccountLink).toBeDefined();
expect(B.isMemberJoined).toBeDefined();
expect(B.isMemberLeft).toBeDefined();
});
it('should export Slack methods', () => {
expect(B.sendText).toBeDefined();
expect(B.postMessage).toBeDefined();
expect(B.postEphemeral).toBeDefined();
});
it('should export Slack predicates', () => {
expect(B.isMessage).toBeDefined();
expect(B.isChannelsMessage).toBeDefined();
expect(B.isGroupsMessage).toBeDefined();
expect(B.isImMessage).toBeDefined();
expect(B.isMpimMessage).toBeDefined();
expect(B.isText).toBeDefined();
expect(B.isInteractiveMessage).toBeDefined();
expect(B.isAppUninstalled).toBeDefined();
expect(B.isChannelArchive).toBeDefined();
expect(B.isChannelCreated).toBeDefined();
expect(B.isChannelDeleted).toBeDefined();
expect(B.isChannelHistoryChanged).toBeDefined();
expect(B.isChannelRename).toBeDefined();
expect(B.isChannelUnarchive).toBeDefined();
expect(B.isDndUpdated).toBeDefined();
expect(B.isDndUpdated_user).toBeDefined();
expect(B.isEmailDomainChanged).toBeDefined();
expect(B.isEmojiChanged).toBeDefined();
expect(B.isFileChange).toBeDefined();
expect(B.isFileCommentAdded).toBeDefined();
expect(B.isFileCommentDeleted).toBeDefined();
expect(B.isFileCommentEdited).toBeDefined();
expect(B.isFileCreated).toBeDefined();
expect(B.isFileDeleted).toBeDefined();
expect(B.isFilePublic).toBeDefined();
expect(B.isFileShared).toBeDefined();
expect(B.isFileUnshared).toBeDefined();
expect(B.isGridMigrationFinished).toBeDefined();
expect(B.isGridMigrationStarted).toBeDefined();
expect(B.isGroupArchive).toBeDefined();
expect(B.isGroupClose).toBeDefined();
expect(B.isGroupHistoryChanged).toBeDefined();
expect(B.isGroupOpen).toBeDefined();
expect(B.isGroupRename).toBeDefined();
expect(B.isGroupUnarchive).toBeDefined();
expect(B.isImClose).toBeDefined();
expect(B.isImCreated).toBeDefined();
expect(B.isImHistoryChanged).toBeDefined();
expect(B.isImOpen).toBeDefined();
expect(B.isLinkShared).toBeDefined();
expect(B.isMemberJoinedChannel).toBeDefined();
expect(B.isMemberLeftChannel).toBeDefined();
expect(B.isPinAdded).toBeDefined();
expect(B.isPinRemoved).toBeDefined();
expect(B.isReactionAdded).toBeDefined();
expect(B.isReactionRemoved).toBeDefined();
expect(B.isStarAdded).toBeDefined();
expect(B.isStarRemoved).toBeDefined();
expect(B.isSubteamCreated).toBeDefined();
expect(B.isSubteamMembersChanged).toBeDefined();
expect(B.isSubteamSelfAdded).toBeDefined();
expect(B.isSubteamSelfRemoved).toBeDefined();
expect(B.isSubteamUpdated).toBeDefined();
expect(B.isTeamDomainChange).toBeDefined();
expect(B.isTeamJoin).toBeDefined();
expect(B.isTeamRename).toBeDefined();
expect(B.isTokensRevoked).toBeDefined();
expect(B.isUrlVerification).toBeDefined();
expect(B.isUserChange).toBeDefined();
});
it('should export Telegram methods', () => {
expect(B.sendText).toBeDefined();
expect(B.sendMessage).toBeDefined();
expect(B.sendPhoto).toBeDefined();
expect(B.sendAudio).toBeDefined();
expect(B.sendDocument).toBeDefined();
expect(B.sendSticker).toBeDefined();
expect(B.sendVideo).toBeDefined();
expect(B.sendVoice).toBeDefined();
expect(B.sendVideoNote).toBeDefined();
expect(B.sendMediaGroup).toBeDefined();
expect(B.sendLocation).toBeDefined();
expect(B.sendVenue).toBeDefined();
expect(B.sendContact).toBeDefined();
expect(B.sendChatAction).toBeDefined();
expect(B.editMessageText).toBeDefined();
expect(B.editMessageCaption).toBeDefined();
expect(B.editMessageReplyMarkup).toBeDefined();
expect(B.deleteMessage).toBeDefined();
expect(B.editMessageLiveLocation).toBeDefined();
expect(B.stopMessageLiveLocation).toBeDefined();
expect(B.forwardMessageFrom).toBeDefined();
expect(B.forwardMessageTo).toBeDefined();
expect(B.kickChatMember).toBeDefined();
expect(B.unbanChatMember).toBeDefined();
expect(B.restrictChatMember).toBeDefined();
expect(B.promoteChatMember).toBeDefined();
expect(B.exportChatInviteLink).toBeDefined();
expect(B.setChatPhoto).toBeDefined();
expect(B.deleteChatPhoto).toBeDefined();
expect(B.setChatTitle).toBeDefined();
expect(B.setChatDescription).toBeDefined();
expect(B.setChatStickerSet).toBeDefined();
expect(B.deleteChatStickerSet).toBeDefined();
expect(B.pinChatMessage).toBeDefined();
expect(B.unpinChatMessage).toBeDefined();
expect(B.leaveChat).toBeDefined();
expect(B.sendInvoice).toBeDefined();
expect(B.answerShippingQuery).toBeDefined();
expect(B.answerPreCheckoutQuery).toBeDefined();
expect(B.answerInlineQuery).toBeDefined();
expect(B.sendGame).toBeDefined();
expect(B.setGameScore).toBeDefined();
});
it('should export Telegram predicates', () => {
expect(B.isMessage).toBeDefined();
expect(B.isText).toBeDefined();
expect(B.isAudio).toBeDefined();
expect(B.isDocument).toBeDefined();
expect(B.isGame).toBeDefined();
expect(B.isPhoto).toBeDefined();
expect(B.isSticker).toBeDefined();
expect(B.isVideo).toBeDefined();
expect(B.isVoice).toBeDefined();
expect(B.isVideoNote).toBeDefined();
expect(B.isContact).toBeDefined();
expect(B.isLocation).toBeDefined();
expect(B.isVenue).toBeDefined();
expect(B.isEditedMessage).toBeDefined();
expect(B.isChannelPost).toBeDefined();
expect(B.isEditedChannelPost).toBeDefined();
expect(B.isInlineQuery).toBeDefined();
expect(B.isChosenInlineResult).toBeDefined();
expect(B.isCallbackQuery).toBeDefined();
expect(B.isPayload).toBeDefined();
expect(B.isShippingQuery).toBeDefined();
expect(B.isPreCheckoutQuery).toBeDefined();
});
it('should export Viber methods', () => {
expect(B.sendMessage).toBeDefined();
expect(B.sendText).toBeDefined();
expect(B.sendPicture).toBeDefined();
expect(B.sendVideo).toBeDefined();
expect(B.sendFile).toBeDefined();
expect(B.sendContact).toBeDefined();
expect(B.sendLocation).toBeDefined();
expect(B.sendURL).toBeDefined();
expect(B.sendSticker).toBeDefined();
expect(B.sendCarouselContent).toBeDefined();
});
it('should export Viber predicates', () => {
expect(B.isMessage).toBeDefined();
expect(B.isText).toBeDefined();
expect(B.isPicture).toBeDefined();
expect(B.isVideo).toBeDefined();
expect(B.isFile).toBeDefined();
expect(B.isSticker).toBeDefined();
expect(B.isContact).toBeDefined();
expect(B.isURL).toBeDefined();
expect(B.isLocation).toBeDefined();
expect(B.isSubscribed).toBeDefined();
expect(B.isUnsubscribed).toBeDefined();
expect(B.isConversationStarted).toBeDefined();
expect(B.isDelivered).toBeDefined();
expect(B.isSeen).toBeDefined();
expect(B.isFailed).toBeDefined();
});
it('should export Facebook methods', () => {
expect(B.sendComment).toBeDefined();
expect(B.sendPrivateReply).toBeDefined();
});
it('should export Facebook predicates', () => {
expect(B.isFeed).toBeDefined();
expect(B.isStatus).toBeDefined();
expect(B.isStatusAdd).toBeDefined();
expect(B.isStatusEdited).toBeDefined();
expect(B.isPost).toBeDefined();
expect(B.isPostRemove).toBeDefined();
expect(B.isComment).toBeDefined();
expect(B.isCommentAdd).toBeDefined();
expect(B.isCommentEdited).toBeDefined();
expect(B.isCommentRemove).toBeDefined();
expect(B.isLike).toBeDefined();
expect(B.isLikeAdd).toBeDefined();
expect(B.isLikeRemove).toBeDefined();
expect(B.isReaction).toBeDefined();
expect(B.isReactionAdd).toBeDefined();
expect(B.isReactionEdit).toBeDefined();
expect(B.isReactionRemove).toBeDefined();
});
it('should export other apis', () => {
expect(B._).toBeDefined();
expect(B.branch).toBeDefined();
expect(B.condition).toBeDefined();
expect(B.match).toBeDefined();
expect(B.parallel).toBeDefined();
expect(B.platform).toBeDefined();
expect(B.random).toBeDefined();
expect(B.series).toBeDefined();
expect(B.weight).toBeDefined();
expect(B.noop).toBeDefined();
expect(B.repeat).toBeDefined();
expect(B.delay).toBeDefined();
expect(B.setDisplayName).toBeDefined();
expect(B.attachOptions).toBeDefined();
});
it('should export other predicates', () => {
expect(B.isTextMatch).toBeDefined();
expect(B.isPayloadMatch).toBeDefined();
expect(B.hasStateEqual).toBeDefined();
});
it('should export logic predicates', () => {
expect(B.not).toBeDefined();
expect(B.and).toBeDefined();
expect(B.or).toBeDefined();
expect(B.alwaysTrue).toBeDefined();
expect(B.alwaysFalse).toBeDefined();
});
it('should export logger apis', () => {
expect(B.log).toBeDefined();
expect(B.info).toBeDefined();
expect(B.warn).toBeDefined();
expect(B.error).toBeDefined();
expect(B.createLogger).toBeDefined();
});