add tests for milestones without due date

This commit is contained in:
jhnns 2013-10-04 18:19:38 +02:00
parent eca50c0b84
commit cc7cf05eb5
1 changed files with 40 additions and 0 deletions

View File

@ -25,6 +25,21 @@ module.exports =
assert.equal milestone.number, 1 assert.equal milestone.number, 1
do done do done
'milestones - get current from 1 when milestone has no due date': (done) ->
req.all_milestones = (opts, cb) ->
cb null, [
{
'number': 1
'created_at': '2013-01-01T00:00:00Z'
'due_on': null
}
]
milestones.get_current {}, (err, warn, milestone) ->
assert.ifError err
assert.equal milestone.number, 1
do done
# We always take from head because of request params. # We always take from head because of request params.
'milestones - get current from > 1': (done) -> 'milestones - get current from > 1': (done) ->
req.all_milestones = (opts, cb) -> req.all_milestones = (opts, cb) ->
@ -51,6 +66,31 @@ module.exports =
assert.equal milestone.number, 2 assert.equal milestone.number, 2
do done do done
'milestones - get current from > 1 when there are milestones without due date': (done) ->
req.all_milestones = (opts, cb) ->
cb null, [
{
'number': 2
'created_at': '2013-01-01T00:00:00Z'
'due_on': null
}
{
'number': 1
'created_at': '2013-01-01T00:00:00Z'
'due_on': '2013-02-01T00:00:00Z'
}
{
'number': 3
'created_at': '2013-01-01T00:00:00Z'
'due_on': '2013-02-15T00:00:00Z'
}
]
milestones.get_current {}, (err, warn, milestone) ->
assert.ifError err
assert.equal milestone.number, 1
do done
'milestones - get current when empty': (done) -> 'milestones - get current when empty': (done) ->
req.all_milestones = (opts, cb) -> req.all_milestones = (opts, cb) ->
cb null, [] cb null, []