summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/epoch/tests/unit/time.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'debian/missing-sources/epoch/tests/unit/time.coffee')
-rw-r--r--debian/missing-sources/epoch/tests/unit/time.coffee67
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/missing-sources/epoch/tests/unit/time.coffee b/debian/missing-sources/epoch/tests/unit/time.coffee
new file mode 100644
index 0000000..48593a2
--- /dev/null
+++ b/debian/missing-sources/epoch/tests/unit/time.coffee
@@ -0,0 +1,67 @@
+sinon = require 'sinon'
+
+describe 'Epoch.Time.Plot', ->
+ chart = null
+
+ beforeEach ->
+ chart = new Epoch.Time.Plot(data: [layerWithRange(0, 100)])
+
+ describe 'y', ->
+ scaleDomain = [-524, 2324]
+ beforeEach -> sinon.stub(chart, '_getScaleDomain').returns(scaleDomain)
+ afterEach -> chart._getScaleDomain.restore()
+
+ it 'should get the scale domain from the given domain', ->
+ y = chart.y('a')
+ assert.ok chart._getScaleDomain.calledWith('a')
+ assert.deepEqual y.domain(), scaleDomain
+
+ describe 'ySvg', ->
+ scaleDomain = [3004, 10000000]
+ beforeEach -> sinon.stub(chart, '_getScaleDomain').returns(scaleDomain)
+ afterEach -> chart._getScaleDomain.restore()
+
+ it 'should get the scale domain from the given domain', ->
+ y = chart.ySvg('a')
+ assert.ok chart._getScaleDomain.calledWith('a')
+ assert.deepEqual y.domain(), scaleDomain
+
+ describe 'ySvgLeft', ->
+ beforeEach -> sinon.spy(chart, 'ySvg')
+ afterEach -> chart.ySvg.restore()
+
+ it 'should use the left range when present', ->
+ chart.options.range = { left: 'apples' }
+ chart.ySvgLeft()
+ assert.ok chart.ySvg.calledWith('apples')
+
+ it 'should not use the left range when missing', ->
+ chart.ySvgLeft()
+ assert.ok chart.ySvg.calledOnce
+
+ describe 'ySvgRight', ->
+ beforeEach -> sinon.spy(chart, 'ySvg')
+ afterEach -> chart.ySvg.restore()
+
+ it 'should use the right range when present', ->
+ chart.options.range = { right: 'oranges' }
+ chart.ySvgRight()
+ assert.ok chart.ySvg.calledWith('oranges')
+
+ it 'should not use the right range when missing', ->
+ chart.ySvgRight()
+ assert.ok chart.ySvg.calledOnce
+
+ describe 'leftAxis', ->
+ beforeEach -> sinon.spy chart, 'ySvgLeft'
+ afterEach -> chart.ySvgLeft.restore()
+ it 'uses the left svg scale', ->
+ chart.leftAxis()
+ assert.ok chart.ySvgLeft.calledOnce
+
+ describe 'rightAxis', ->
+ beforeEach -> sinon.spy chart, 'ySvgRight'
+ afterEach -> chart.ySvgRight.restore()
+ it 'uses the right svg scale', ->
+ chart.rightAxis()
+ assert.ok chart.ySvgRight.calledOnce