Renamed MicrosoftSkypeMiddleware to SkypeMiddleware
This commit is contained in:
Родитель
c82cb2e74e
Коммит
7e42adf63c
|
@ -15,7 +15,7 @@ BotBuilder = require 'botbuilder'
|
||||||
{ Robot, Adapter, TextMessage, User } = require 'hubot'
|
{ Robot, Adapter, TextMessage, User } = require 'hubot'
|
||||||
Middleware = require './adapter-middleware'
|
Middleware = require './adapter-middleware'
|
||||||
MicrosoftTeamsMiddleware = require './msteams-middleware'
|
MicrosoftTeamsMiddleware = require './msteams-middleware'
|
||||||
MicrosoftSkypeMiddleware = require './skype-middleware'
|
SkypeMiddleware = require './skype-middleware'
|
||||||
|
|
||||||
LogPrefix = "hubot-botframework-adapter:"
|
LogPrefix = "hubot-botframework-adapter:"
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class BotFrameworkAdapter extends Adapter
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Middleware,
|
Middleware,
|
||||||
MicrosoftTeamsMiddleware,
|
MicrosoftTeamsMiddleware,
|
||||||
MicrosoftSkypeMiddleware
|
SkypeMiddleware
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.use = (robot) ->
|
module.exports.use = (robot) ->
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{ BaseMiddleware, registerMiddleware } = require './adapter-middleware'
|
{ BaseMiddleware, registerMiddleware } = require './adapter-middleware'
|
||||||
LogPrefix = "hubot-skype:"
|
LogPrefix = "hubot-skype:"
|
||||||
|
|
||||||
class MicrosoftSkypeMiddleware extends BaseMiddleware
|
class SkypeMiddleware extends BaseMiddleware
|
||||||
|
|
||||||
toReceivable: (activity) ->
|
toReceivable: (activity) ->
|
||||||
@robot.logger.info "#{LogPrefix} toReceivable"
|
@robot.logger.info "#{LogPrefix} toReceivable"
|
||||||
|
@ -143,6 +143,6 @@ class MicrosoftSkypeMiddleware extends BaseMiddleware
|
||||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")
|
||||||
|
|
||||||
|
|
||||||
registerMiddleware 'skype', MicrosoftSkypeMiddleware
|
registerMiddleware 'skype', SkypeMiddleware
|
||||||
|
|
||||||
module.exports = MicrosoftSkypeMiddleware
|
module.exports = SkypeMiddleware
|
||||||
|
|
|
@ -2,9 +2,9 @@ chai = require 'chai'
|
||||||
expect = chai.expect
|
expect = chai.expect
|
||||||
{ TextMessage, Message, User } = require 'hubot'
|
{ TextMessage, Message, User } = require 'hubot'
|
||||||
MockRobot = require './mock-robot'
|
MockRobot = require './mock-robot'
|
||||||
MicrosoftSkypeMiddleware = require '../src/skype-middleware'
|
SkypeMiddleware = require '../src/skype-middleware'
|
||||||
|
|
||||||
describe 'MicrosoftSkypeMiddleware', ->
|
describe 'SkypeMiddleware', ->
|
||||||
describe 'toReceivable', ->
|
describe 'toReceivable', ->
|
||||||
robot = null
|
robot = null
|
||||||
event = null
|
event = null
|
||||||
|
@ -43,7 +43,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
it 'return generic message when appropriate type is not found', ->
|
it 'return generic message when appropriate type is not found', ->
|
||||||
# Setup
|
# Setup
|
||||||
event.type = 'typing'
|
event.type = 'typing'
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
receivable = null
|
receivable = null
|
||||||
|
@ -57,7 +57,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
it 'should work when activity text is an object', ->
|
it 'should work when activity text is an object', ->
|
||||||
# Setup
|
# Setup
|
||||||
event.text = event
|
event.text = event
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
receivable = null
|
receivable = null
|
||||||
|
@ -71,7 +71,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
it 'should work when mentions not provided', ->
|
it 'should work when mentions not provided', ->
|
||||||
# Setup
|
# Setup
|
||||||
delete event.entities
|
delete event.entities
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
receivable = null
|
receivable = null
|
||||||
|
@ -84,7 +84,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
|
|
||||||
it 'should replace all @ mentions', ->
|
it 'should replace all @ mentions', ->
|
||||||
# Setup
|
# Setup
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
receivable = null
|
receivable = null
|
||||||
|
@ -99,7 +99,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
it 'should replace at mentions even when entities is not an array', ->
|
it 'should replace at mentions even when entities is not an array', ->
|
||||||
# Setup
|
# Setup
|
||||||
event.entities = event.entities[0]
|
event.entities = event.entities[0]
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
receivable = null
|
receivable = null
|
||||||
|
@ -115,7 +115,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
# Setup
|
# Setup
|
||||||
event.address.conversation.id = event.address.user.id
|
event.address.conversation.id = event.address.user.id
|
||||||
event.text = 'do something <at>Bot</at> and tell <at>User</at> about it'
|
event.text = 'do something <at>Bot</at> and tell <at>User</at> about it'
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
receivable = null
|
receivable = null
|
||||||
|
@ -170,7 +170,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
|
|
||||||
it 'should create message object for string messages', ->
|
it 'should create message object for string messages', ->
|
||||||
# Setup
|
# Setup
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
sendable = null
|
sendable = null
|
||||||
|
@ -194,7 +194,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
# Setup
|
# Setup
|
||||||
message =
|
message =
|
||||||
type: "some message type"
|
type: "some message type"
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
sendable = null
|
sendable = null
|
||||||
|
@ -215,7 +215,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
it 'should convert images', ->
|
it 'should convert images', ->
|
||||||
# Setup
|
# Setup
|
||||||
message = "http://test.com/thisisanimage.jpg"
|
message = "http://test.com/thisisanimage.jpg"
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
sendable = null
|
sendable = null
|
||||||
|
@ -242,7 +242,7 @@ describe 'MicrosoftSkypeMiddleware', ->
|
||||||
it 'should not convert other links', ->
|
it 'should not convert other links', ->
|
||||||
# Setup
|
# Setup
|
||||||
message = "http://test.com/thisisanimage.html"
|
message = "http://test.com/thisisanimage.html"
|
||||||
skypeMiddleware = new MicrosoftSkypeMiddleware(robot)
|
skypeMiddleware = new SkypeMiddleware(robot)
|
||||||
|
|
||||||
# Action
|
# Action
|
||||||
sendable = null
|
sendable = null
|
||||||
|
|
Загрузка…
Ссылка в новой задаче