erg
Version:
Erg time calculator
32 lines (19 loc) • 725 B
text/coffeescript
{ Duration } = require('../../src/metrics/duration')
describe 'Metrics', -> \
describe 'Duration', ->
context 'constructed from 3683.123 seconds', ->
beforeEach -> @d = new Duration(3683.123)
describe 'virtual fields', ->
it 'yield 1 hour', ->
it 'yield 1 minute', ->
it 'yield 23 seconds', ->
it 'yield 123 ms', ->
describe '#toString', ->
it 'generates hourly if required', ->
new Duration(3600.123).toString().should.match /^1:/
it 'excludes hourly if not large enough', ->
new Duration(3599.123).toString().should.not.match /^1:/