Skip to content

Commit

Permalink
fix(view): add factory test
Browse files Browse the repository at this point in the history
  • Loading branch information
HandsomeButterball committed Apr 2, 2021
1 parent e385c4e commit 448f9d4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/gantt/src/views/test/factory.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { GanttViewMonth } from '../month';
import { GanttViewDay } from '../day';
import { GanttViewQuarter } from '../quarter';
import { createViewFactory } from '../factory';
import { GanttViewType } from '../../class';
import { date } from './mock';

describe('CreateViewFactory', () => {
it(`should be day view`, () => {
const dayView = createViewFactory(GanttViewType.day, date.start, date.end);
expect(dayView).toEqual(jasmine.any(GanttViewDay));
});

it(`should be month view`, () => {
const monthView = createViewFactory(GanttViewType.month, date.start, date.end);
expect(monthView).toEqual(jasmine.any(GanttViewMonth));
});

it(`should be quarter view`, () => {
const quarterView = createViewFactory(GanttViewType.quarter, date.start, date.end);
expect(quarterView).toEqual(jasmine.any(GanttViewQuarter));
});

it(`should `, () => {
expect(() => {
createViewFactory(GanttViewType.year, date.start, date.end);
}).toThrow(new Error('gantt view type invalid'));
});
});

0 comments on commit 448f9d4

Please sign in to comment.