-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
325 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- "5.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Facebook = require './src/facebook' | ||
{StickerMessage} = require './src/message' | ||
{StickerListener} = require './src/listener' | ||
|
||
module.exports = exports = { | ||
StickerMessage | ||
StickerListener | ||
} | ||
|
||
exports.use = (robot) -> | ||
new Facebook robot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{ | ||
"name": "hubot-facebook", | ||
"version": "0.5.0", | ||
"version": "0.5.2", | ||
"description": "Facebook chat adapter for hubot", | ||
"main": "./src/facebook", | ||
"main": "./index", | ||
"scripts": { | ||
"test": "mocha --compilers coffee:coffee-script/register --reporter spec" | ||
}, | ||
"author": "Clicia Scarlet <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
|
@@ -11,6 +14,9 @@ | |
}, | ||
"dependencies": { | ||
"facebook-chat-api": "1.0.8", | ||
"coffee-script": "~1.7.1", | ||
"should": "~2.0.2", | ||
"mocha": "~1.13.0", | ||
"hubot": "~2.13" | ||
}, | ||
"engines": { | ||
|
@@ -22,6 +28,5 @@ | |
"name": "blazeu", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"scripts": {} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{Facebook} = require '../index' | ||
|
||
should = require 'should' | ||
|
||
describe 'Adapter', -> | ||
it 'Should initialize with a robot', -> | ||
@facebook.robot.should.eql @stubs.robot | ||
|
||
describe 'Login', -> | ||
it 'Should set the robot name', -> | ||
@facebook.setName => | ||
@facebook.robot.name.should.equal @stubs.self.name | ||
|
||
describe 'Send Messages', -> | ||
it 'Should send multiple messages', -> | ||
@facebook.send {room: 'general'}, 'one', 'two', 'three' | ||
@stubs._msg.length.should.equal 3 | ||
|
||
it 'Should not send empty messages', -> | ||
@facebook.send {room: 'general'}, 'Hello', '', '', 'world!' | ||
@stubs._msg.length.should.equal 2 | ||
|
||
describe 'Send Private Messages', -> | ||
it 'Should send multiple message', -> | ||
@facebook.sendPrivate {user: id: 'name'}, 'one', 'two', 'three' | ||
@stubs._msg.length.should.equal 3 | ||
@stubs._msg[0].msg.body.should.eql 'one' | ||
@stubs._msg[0].thread.should.eql 'name' | ||
|
||
it 'Should not send empty messages', -> | ||
@facebook.sendPrivate {user: id: 'name'}, 'Hello', '', '', 'world!' | ||
@stubs._msg.length.should.equal 2 | ||
|
||
describe 'Send Sticker Messages', -> | ||
it 'Should send multiple sticker', -> | ||
@facebook.sendSticker {room: 'general'}, 'pusheen1', 'pusheen2' | ||
@stubs._msg.length.should.equal 2 | ||
@stubs._msg[0].msg.sticker.should.eql 'pusheen1' | ||
|
||
# TODO test send file | ||
|
||
describe 'Other action', -> | ||
it 'Should mark as read', -> | ||
@facebook.read {room: 'general'} | ||
@stubs._readed.general.should.equal true | ||
|
||
it 'Should reply a message', -> | ||
@facebook.reply {room: 'general', message: user: name: "user"}, "test" | ||
@stubs._msg.length.should.equal 1 | ||
@stubs._msg[0].msg.body.should.eql '@user test' | ||
|
||
it 'Should reply a message only with first name', -> | ||
@facebook.reply {room: 'general', message: user: name: "first last"}, "test" | ||
@stubs._msg.length.should.equal 1 | ||
@stubs._msg[0].msg.body.should.eql '@first test' | ||
|
||
it 'Should set topic', -> | ||
@facebook.topic {room: 'general'}, 'test1', 'test2' | ||
@stubs._title.general.should.eql 'test1 test2' |
Oops, something went wrong.