X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fformats.js;h=2548d99fd7c009b4614408d989281effa97ef8d8;hb=HEAD;hp=a0b779baa4534387d1571384f0d937798a1cbf34;hpb=1b7afc93886e2927b6f320e8e1ed4dd6bd9ab53b;p=dygraphs.git diff --git a/auto_tests/tests/formats.js b/auto_tests/tests/formats.js index a0b779b..2548d99 100644 --- a/auto_tests/tests/formats.js +++ b/auto_tests/tests/formats.js @@ -3,14 +3,12 @@ * * @author konigsberg@google.com (Robert Konigsberg) */ -describe("formats", function() { -beforeEach(function() { - document.body.innerHTML = "
"; -}); +import Dygraph from '../../src/dygraph'; -afterEach(function() { -}); +describe("formats", function() { + +cleanupAfterEach(); var dataString = "X,Y\n" + @@ -79,6 +77,16 @@ it('testXValueParser', function() { assert.equal(6, g.getValue(3, 0)); }); +it('should throw on strings in native format', () => { + assert.throws(() => { + new Dygraph('graph', [['1', '10'], ['2', '20']]) + }, /expected number or date/i); + + assert.throws(() => { + new Dygraph('graph', [[new Date(), '10'], [new Date(), '20']]) + }, /expected number or array/i); +}); + var assertData = function(g) { var expected = dataArray;