Skip to content

Commit ed11f2e

Browse files
committed
add jest tests
1 parent 9e6e49e commit ed11f2e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

packages/devextreme/js/__internal/scheduler/utils/data_accessor/appointment_data_accessor.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,40 @@ describe('AppointmentDataAccessor', () => {
7373
expect(dataAccessor.has('startDate')).toBe(true);
7474
expect(dataAccessor.has('endDate')).toBe(false);
7575
});
76+
77+
it('should return date', () => {
78+
const dataAccessor = new AppointmentDataAccessor({
79+
startDateExpr: 'startDate',
80+
endDateExpr: 'endDate',
81+
} as any, true);
82+
const obj = {
83+
startDate: '2025-05-30T15:00:00.000Z',
84+
endDate: '2025-05-30T15:00:00.000Z',
85+
};
86+
87+
expect(dataAccessor.get('startDate', obj)).toEqual(new Date('2025-05-30T15:00:00.000Z'));
88+
expect(dataAccessor.get('endDate', obj)).toEqual(new Date('2025-05-30T15:00:00.000Z'));
89+
});
90+
91+
it('should return undefined for date fields', () => {
92+
const dataAccessor = new AppointmentDataAccessor({
93+
startDateExpr: 'startDate',
94+
endDateExpr: 'endDate',
95+
} as any, true);
96+
const obj = {};
97+
98+
expect(dataAccessor.get('startDate', obj)).toBe(undefined);
99+
expect(dataAccessor.get('endDate', obj)).toBe(undefined);
100+
});
101+
102+
it('should return boolean', () => {
103+
const dataAccessor = new AppointmentDataAccessor({
104+
disabledExpr: 'disabled',
105+
allDayExpr: 'allDay',
106+
} as any, true);
107+
const obj: any = {};
108+
109+
expect(dataAccessor.get('disabled', obj)).toBe(false);
110+
expect(dataAccessor.get('allDay', obj)).toBe(false);
111+
});
76112
});

0 commit comments

Comments
 (0)