more testing

This commit is contained in:
Radek Stepan 2014-10-29 19:52:58 -06:00
parent 15a3573804
commit 41a36a43f8
20 changed files with 212 additions and 23 deletions

View File

@ -14,7 +14,7 @@ watch:
# Watch the app.
watch-js:
$(WATCH) -e ./src/app.coffee -o public/js/app.bundle.js -d -v
$(WATCH) -e ./src/app.coffee -o public/js/app.bundle.js -d -v
# Watch the styles.
watch-css:
@ -35,7 +35,7 @@ build:
publish:
$(GRUNT) gh-pages
OPTS = --compilers coffee:coffee-script/register --ui exports --timeout 20000 --slow 15000 --bail
OPTS = --compilers coffee:coffee-script/register --ui exports --bail
# Run mocha test.
test:

File diff suppressed because one or more lines are too long

View File

@ -2,9 +2,7 @@
- [ ] create notes about how original people can upgrade to burnchart
- [ ] clean up docs, track them on git or using Assembly system?
- [ ] rename repo to burnchart
- [ ] check with austin@assembly.com if my repo looks good to be forked to Assembly
- [ ] move domain to Assembly
- [ ] fork it to Assembly
- [ ] landing page for the project and put message on `github-burndown-chart` repo
- [ ] provide a documentation site (because we ref it from hero)
@ -12,6 +10,7 @@
##Next Release
- [ ] make coverage work
- [ ] http://burnchart.io#rails I would expect it to list all the projects for that owner so I can select one of them (Ryan); we could show a list of available project names with their: `description`, `private` flag and `has_issues` making the project greyed out if no issues found
##Backlog

Binary file not shown.

View File

@ -20,6 +20,7 @@
<glyph glyph-name="spinner1" unicode="&#xe80b;" d="m469 614v204q129 0 237-61t169-170 62-237h-204q0 72-36 133t-95 96-133 35z" horiz-adv-x="937.5" />
<glyph glyph-name="attention" unicode="&#xe80c;" d="m957-24q10-16 0-34-10-16-30-16l-892 0q-18 0-28 16-13 18-2 34l446 782q8 18 30 18t30-18z m-420 50l0 100-110 0 0-100 110 0z m0 174l0 300-110 0 0-300 110 0z" horiz-adv-x="962" />
<glyph glyph-name="download-cloud" unicode="&#xe80d;" d="m0 243q0 72 39 134t105 92q-1 17-1 24 0 118 84 202t202 84q87 0 159-49t105-129q40 35 93 35 59 0 101-42t42-101q0-43-23-77 72-17 119-76t46-133q0-89-62-151t-152-63h-607q-103 0-177 73t-73 177z m286 89q0-8 5-13l196-196q5-5 13-5t13 5l196 196q5 6 5 13 0 8-5 13t-13 5h-125v196q0 8-5 13t-12 5h-108q-7 0-12-5t-5-13v-196h-125q-8 0-13-5t-5-13z" horiz-adv-x="1071.4" />
<glyph glyph-name="heart" unicode="&#xe80e;" d="m508-66q-17 0-29 9-26 17-85 58t-154 112-134 110q-106 106-106 264 0 116 82 198t198 82q143 0 228-118 38 55 99 86t129 32q117 0 198-82t81-198q0-158-106-264-38-38-133-110t-155-113-83-57q-13-9-30-9z m-228 729q-72 0-124-51t-52-125q0-114 76-190 79-79 328-248 248 169 327 248 76 76 76 190 0 73-51 125t-124 51q-73 0-125-51t-51-125q0-22-16-37t-36-15-37 15-15 37q0 73-52 125t-124 51z" horiz-adv-x="1015" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,8 @@ require './models/projects.coffee'
Header = require './views/header.coffee'
Notify = require './views/notify.coffee'
Icons = require './views/icons.coffee'
router = require './modules/router.coffee'
new Ractive
@ -17,7 +19,7 @@ new Ractive
'el': 'body'
'components': { Header, Notify }
'components': { Header, Notify, Icons }
onrender: ->
# Start the router.

View File

@ -32,4 +32,8 @@ module.exports = new Model
# How do we specify which user/repo/(milestone) we want?
"location": /^#!((\/[^\/]+){2,3})$/
# Process all issues as one size (ONE_SIZE) or use labels (LABELS).
"points": 'ONE_SIZE'
"points": 'ONE_SIZE'
# Request pertaining.
"request":
# Default timeout of 5s.
"timeout": 5e3

View File

@ -113,6 +113,7 @@ module.exports = new Model
# We are supposed to exist already.
throw 500
# TODO: remove in production.
demo: ->
@set 'list': [
{ 'owner': 'mbostock', 'name': 'd3' }
@ -166,6 +167,6 @@ module.exports = new Model
@observe 'sortBy', ->
# Use pop as Ractive is glitchy when resetting arrays.
@set 'index', null
# Run the sort again.
# Run the sort again.
do @sort
, 'init': no

View File

@ -4,7 +4,8 @@ superagent = require 'superagent'
# Lodash mixins.
require '../../utils/mixins.coffee'
user = require '../../models/user.coffee'
config = require '../../models/config.coffee'
user = require '../../models/user.coffee'
# Custom JSON parser.
superagent.parse =
@ -90,7 +91,7 @@ request = ({ protocol, host, path, query, headers }, cb) ->
timeout = setTimeout ->
exited = yes
cb 'Request has timed out'
, 5e3 # give us 5s
, config.data.request.timeout # wait this long
# Send.
req.end (err, data) ->

View File

@ -18,7 +18,7 @@ module.exports = (milestone) ->
isDone = yes if points is 100
# Milestones with no due date are always on track.
return { isOverdue, isOnTime, isDone, isEmpty, 'progress': { points } } unless milestone.due_on
return { isOverdue, isOnTime, isDone, isEmpty, 'progress': { points } } unless milestone.due_on?
a = +new Date milestone.created_at
b = +new Date

View File

@ -8,7 +8,7 @@
<div id="footer">
<div class="wrap">
&copy; 2012-2014 <a href="http://cloudfi.re">Cloudfire Systems</a>
&copy; 2012-2014 <a href="https://assembly.com/burnchart">Made with <Icons icon="heart"/> on Assembly</a>
</div>
</div>
</div>

View File

@ -18,6 +18,7 @@ codes =
'spinner1': '\e80b'
'attention': '\e80c'
'download-cloud': '\e80d'
'heart': '\e80e'
module.exports = Ractive.extend

View File

@ -1,7 +1,6 @@
proxy = do require('proxyquire').noCallThru
assert = require 'assert'
path = require 'path'
require 'blanket'
request = {}

View File

@ -1,7 +1,6 @@
proxy = do require('proxyquire').noCallThru
assert = require 'assert'
path = require 'path'
require 'blanket'
lines = require '../src/modules/chart/lines.coffee'

View File

@ -1,12 +1,139 @@
proxy = do require('proxyquire').noCallThru
assert = require 'assert'
path = require 'path'
require 'blanket'
_ = require 'lodash'
projects = require '../src/models/projects.coffee'
projects = proxy path.resolve(__dirname, '../src/models/projects.coffee'),
# Just return the stats that are on the milestone already.
'../modules/stats.coffee': ({ stats }) -> stats
module.exports =
'projects - initializes empty': (done) ->
assert.deepEqual projects.data.list, [ ]
do done
'projects - sorts on new milestones': (done) ->
do projects.clear
project = { 'owner': 'radekstepan', 'name': 'burnchart' }
milestone = 'title': '1.0.0'
projects.push 'list', project
projects.addMilestone project, milestone
assert.deepEqual projects.data.index, [ [ 0, 0 ] ]
do done
'projects - sort by progress': (done) ->
do projects.clear
projects.set 'sortBy', 'progress'
project = { 'owner': 'radekstepan', 'name': 'burnchart' }
milestone1 = 'title': '1.0.0', 'stats': {
'progress': { 'points': 5 }
}
milestone2 = 'title': '2.0.0', 'stats': {
'progress': { 'points': 7 }
}
projects.push 'list', project
projects.addMilestone project, milestone1
projects.addMilestone project, milestone2
assert.deepEqual projects.data.index, [ [ 0, 1 ], [ 0, 0 ] ]
do done
# (points - time) * days
'projects - sort by priority': (done) ->
do projects.clear
projects.set 'sortBy', 'priority'
project = { 'owner': 'radekstepan', 'name': 'burnchart' }
milestone1 = 'title': '1.0.0', 'stats': {
'progress': { 'points': 2, 'time': 1 }
'days': 2
}
milestone2 = 'title': '2.0.0', 'stats': {
'progress': { 'points': 2, 'time': 1 }
'days': 3
}
milestone3 = 'title': '3.0.0', 'stats': {
'progress': { 'points': 1, 'time': 2 }
'days': 4
}
projects.push 'list', project
projects.addMilestone project, milestone1
projects.addMilestone project, milestone2
projects.addMilestone project, milestone3
assert.deepEqual projects.data.index, [ [ 0, 2 ], [ 0, 0 ], [ 0, 1 ] ]
do done
# (points - time) * days
'projects - sort by priority defaults': (done) ->
do projects.clear
projects.set 'sortBy', 'priority'
project = { 'owner': 'radekstepan', 'name': 'burnchart' }
milestone1 = 'title': '1.0.0', 'stats': {
'progress': { 'points': 3 }
}
milestone2 = 'title': '2.0.0', 'stats': {
'progress': { 'points': 2 }
}
milestone3 = 'title': '3.0.0', 'stats': {
'progress': { 'points': 1 }
}
projects.push 'list', project
projects.addMilestone project, milestone1
projects.addMilestone project, milestone2
projects.addMilestone project, milestone3
assert.deepEqual projects.data.index, [ [ 0, 2 ], [ 0, 1 ], [ 0, 0 ] ]
do done
'projects - sort by name': (done) ->
do projects.clear
projects.set 'sortBy', 'name'
project = { 'owner': 'radekstepan', 'name': 'burnchart' }
milestone1 = 'title': 'B'
milestone2 = 'title': 'A'
projects.push 'list', project
projects.addMilestone project, milestone1
projects.addMilestone project, milestone2
assert.deepEqual projects.data.index, [ [ 0, 1 ], [ 0, 0 ] ]
do done
'projects - sort by name semver': (done) ->
do projects.clear
projects.set 'sortBy', 'name'
project = { 'owner': 'radekstepan', 'name': 'burnchart' }
milestone1 = 'title': '1.2.5'
milestone2 = 'title': '1.1.x'
milestone3 = 'title': '1.1.7'
projects.push 'list', project
projects.addMilestone project, milestone1
projects.addMilestone project, milestone2
projects.addMilestone project, milestone3
assert.deepEqual projects.data.index, [ [ 0, 2 ], [ 0, 1 ], [ 0, 0 ] ]
do done

View File

@ -1,7 +1,6 @@
proxy = do require('proxyquire').noCallThru
assert = require 'assert'
path = require 'path'
require 'blanket'
class Sa
@ -34,6 +33,9 @@ request = proxy path.resolve(__dirname, '../src/modules/github/request.coffee'),
user = require '../src/models/user.coffee'
user.set 'ready', yes
# Get config so we can fudge timeout.
config = require '../src/models/config.coffee'
module.exports =
'request - all milestones (ok)': (done) ->
@ -123,7 +125,10 @@ module.exports =
do done
'request - timeout': (done) ->
superagent.timeout = 5001
# Run this last or reset timeout to default again...
config.set 'request.timeout', 10
superagent.timeout = 11
superagent.response =
'statusType': 2
'error': no

View File

@ -1,18 +1,68 @@
proxy = do require('proxyquire').noCallThru
assert = require 'assert'
path = require 'path'
require 'blanket'
stats = require '../src/modules/stats.coffee'
module.exports =
'stats - empty milestone': (done) ->
'stats - is milestone empty, on time and overdue? no due date': (done) ->
milestone =
'issues':
'open': { 'size': 0 }
'closed': { 'size': 0 }
{ isEmpty } = stats milestone
{ isEmpty, isOverdue, isOnTime } = stats milestone
assert.equal isEmpty, yes
assert.equal isOverdue, no
assert.equal isOnTime, yes
do done
'stats - is milestone done?': (done) ->
milestone =
'issues':
'open': { 'size': 0 }
'closed': { 'size': 5 }
{ isDone } = stats milestone
assert.equal isDone, yes
do done
'stats - is milestone overdue? has due date': (done) ->
milestone =
'due_on': 0
'issues':
'open': { 'size': 0 }
'closed': { 'size': 0 }
{ isOverdue } = stats milestone
assert.equal isOverdue, yes
do done
'stats - is milestone on time? has due date, yes': (done) ->
now = +new Date
milestone =
'created_at': now - 1e3
'due_on': 1e4 + now
'issues':
'open': { 'size': 1 }
'closed': { 'size': 1 }
{ isOnTime } = stats milestone
assert.equal isOnTime, yes
do done
'stats - is milestone on time? has due date, no': (done) ->
now = +new Date
milestone =
'created_at': now - 1e4
'due_on': 1e3 + now
'issues':
'open': { 'size': 1 }
'closed': { 'size': 1 }
{ isOnTime } = stats milestone
assert.equal isOnTime, no
do done