Skip to content

Commit

Permalink
cover some more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mose committed Jul 18, 2016
1 parent 7b9d284 commit 50f182b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/phabricator_test.coffee
@@ -1,6 +1,7 @@
Phabricator = require('../lib/phabricator.coffee')
sinon = require("sinon")
expect = require('chai').use(require('sinon-chai')).expect
nock = require('nock')

describe 'Phabricator lib', ->

Expand Down
20 changes: 19 additions & 1 deletion test/phabs_test.coffee
Expand Up @@ -34,7 +34,7 @@ describe 'hubot-phabs module', ->
process.env.PHABRICATOR_URL = 'http://example.com'
process.env.PHABRICATOR_API_KEY = 'xxx'
process.env.PHABRICATOR_BOT_PHID = 'PHID-USER-xxx'
process.env.PHABRICATOR_PROJECTS = 'PHID-PROJ-xxx:proj1,PHID-PROJ-yyy:proj2'
process.env.PHABRICATOR_PROJECTS = 'PHID-PROJ-xxx:proj1,PHID-PCOL-yyy:proj2'
room = helper.createRoom { httpd: false }
room.robot.brain.userForId 'user',
name: 'user'
Expand Down Expand Up @@ -247,6 +247,24 @@ describe 'hubot-phabs module', ->
expect(hubotResponse()).to.eql 'Something went wrong'


context 'phab new proj2 a task', ->
beforeEach ->
do nock.disableNetConnect
nock(process.env.PHABRICATOR_URL)
.get('/api/user.query')
.reply(200, { result: [ { phid: 'PHID-USER-42' } ] })
.get('/api/maniphest.edit')
.reply(200, { result: { object: { id: 24 } } })

afterEach ->
nock.cleanAll()

context 'when user is known and his phid is in the brain', ->
hubot 'phab new proj2 a task', 'user_with_phid'
it 'replies with the object id', ->
expect(hubotResponse()).to.eql 'Task T24 created = http://example.com/T24'


# ---------------------------------------------------------------------------------
context 'user changes status for a task', ->
context 'when the task is unknown', ->
Expand Down

0 comments on commit 50f182b

Please sign in to comment.