X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fsmooth_plotter.js;h=146e4269264f32d4abc8c53714aebc6decb5335c;hb=ac928d203b05de4a8d43ad89667347865e98bb7c;hp=2268bb35f549c452887e5eddaf427d3f67d5f735;hpb=c17e11738cb5603fafcdc84527114502312344c4;p=dygraphs.git diff --git a/auto_tests/tests/smooth_plotter.js b/auto_tests/tests/smooth_plotter.js index 2268bb3..146e426 100644 --- a/auto_tests/tests/smooth_plotter.js +++ b/auto_tests/tests/smooth_plotter.js @@ -3,43 +3,50 @@ * * @author danvdk@gmail.com (Dan Vanderkam) */ -var smoothPlotterTestCase = TestCase("smooth-plotter"); +import Dygraph from '../../src/dygraph'; +import '../../src/extras/smooth-plotter'; // defines Dygraph.smoothPlotter + +describe("smooth-plotter", function() { + +var smoothPlotter = Dygraph.smoothPlotter; var getControlPoints = smoothPlotter._getControlPoints; -smoothPlotterTestCase.prototype.setUp = function() { -}; +beforeEach(function() { +}); -smoothPlotterTestCase.prototype.tearDown = function() { -}; +afterEach(function() { +}); -smoothPlotterTestCase.prototype.testNoSmoothing = function() { +it('testNoSmoothing', function() { var lastPt = {x: 10, y: 0}, pt = {x: 11, y: 1}, nextPt = {x: 12, y: 0}, alpha = 0; - assertEquals([11, 1, 11, 1], getControlPoints(lastPt, pt, nextPt, alpha)); -}; + assert.deepEqual([11, 1, 11, 1], getControlPoints(lastPt, pt, nextPt, alpha)); +}); -smoothPlotterTestCase.prototype.testHalfSmoothing = function() { +it('testHalfSmoothing', function() { var lastPt = {x: 10, y: 0}, pt = {x: 11, y: 1}, nextPt = {x: 12, y: 0}, alpha = 0.5; - assertEquals([10.5, 1, 11.5, 1], getControlPoints(lastPt, pt, nextPt, alpha)); -} + assert.deepEqual([10.5, 1, 11.5, 1], getControlPoints(lastPt, pt, nextPt, alpha)); +}); -smoothPlotterTestCase.prototype.testExtrema = function() { +it('testExtrema', function() { var lastPt = {x: 10, y: 0}, pt = {x: 11, y: 1}, nextPt = {x: 12, y: 1}, alpha = 0.5; - assertEquals([10.5, 0.75, 11.5, 1.25], + assert.deepEqual([10.5, 0.75, 11.5, 1.25], getControlPoints(lastPt, pt, nextPt, alpha, true)); - assertEquals([10.5, 1, 11.5, 1], + assert.deepEqual([10.5, 1, 11.5, 1], getControlPoints(lastPt, pt, nextPt, alpha, false)); -} +}); + +});