From 0515375cfa0f1f96410dcb2e9ecd0aadb8877a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20W=C3=BCrtz?= Date: Sat, 6 Jul 2019 11:54:45 -0300 Subject: [PATCH] test(ganttDb.spec): clear function --- src/diagrams/gantt/ganttDb.spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/diagrams/gantt/ganttDb.spec.js b/src/diagrams/gantt/ganttDb.spec.js index 2601c9497..f24239c96 100644 --- a/src/diagrams/gantt/ganttDb.spec.js +++ b/src/diagrams/gantt/ganttDb.spec.js @@ -7,6 +7,29 @@ describe('when using the ganttDb', function () { ganttDb.clear() }) + describe('when calling the clear function', function () { + beforeEach(function () { + ganttDb.setDateFormat('YYYY-MM-DD') + ganttDb.setExcludes('weekends 2019-02-06,friday') + ganttDb.addSection('weekends skip test') + ganttDb.addTask('test1', 'id1,2019-02-01,1d') + ganttDb.addTask('test2', 'id2,after id1,2d') + ganttDb.clear() + }) + + it.each` + fn | expected + ${'getTasks'} | ${[]} + ${'getTitle'} | ${''} + ${'getDateFormat'}| ${''} + ${'getAxisFormat'}| ${''} + ${'getExcludes'} | ${[]} + ${'getSections'} | ${[]} + `('should clear $fn', ({ fn, expected }) => { + expect(ganttDb[ fn ]()).toEqual(expected) +}) + }) + it.each` testName | section | taskName | taskData | expStartDate | expEndDate | expId | expTask ${'should handle fixed dates'} | ${'testa1'} | ${'test1'} | ${'id1,2013-01-01,2013-01-12'} | ${new Date(2013, 0, 1)} | ${new Date(2013, 0, 12)} | ${'id1'} | ${'test1'}