Skip to content

Commit

Permalink
test(ganttDb.spec): add simple tests for the durationToDate fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Würtz committed Jul 7, 2019
1 parent 047760a commit c6511ed
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/diagrams/gantt/ganttDb.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ describe('when using the ganttDb', function () {
ganttDb.clear()
})

describe('when using relative times', function () {
it.each`
diff | date | expected
${' 1d'} | ${moment('2019-01-01')} | ${moment('2019-01-02').toDate()}
${' 1w'} | ${moment('2019-01-01')} | ${moment('2019-01-08').toDate()}
`('should add $diff to $date resulting in $expected', ({ diff, date, expected }) => {
expect(ganttDb.durationToDate(diff, date)).toEqual(expected)
})
})

describe('when calling the clear function', function () {
beforeEach(function () {
ganttDb.setDateFormat('YYYY-MM-DD')
Expand Down

0 comments on commit c6511ed

Please sign in to comment.