Skip to content

Commit 6fdf93a

Browse files
committed
Fixing broken unit test.
1 parent 1e54b54 commit 6fdf93a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.spec.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ describe('AssignedSiteDialogComponent', () => {
178178
describe('Form Initialization', () => {
179179
it('should initialize form with correct structure', () => {
180180
component.ngOnInit();
181-
181+
182182
expect(component.assignedSiteForm).toBeDefined();
183183
expect(component.assignedSiteForm.get('useGoogleSheetAsDefault')).toBeDefined();
184184
expect(component.assignedSiteForm.get('useOnlyPlanHours')).toBeDefined();
@@ -189,17 +189,17 @@ describe('AssignedSiteDialogComponent', () => {
189189

190190
it('should populate form with data values', () => {
191191
component.ngOnInit();
192-
192+
193193
expect(component.assignedSiteForm.get('useGoogleSheetAsDefault')?.value).toBe(false);
194194
expect(component.assignedSiteForm.get('useOnlyPlanHours')?.value).toBe(false);
195195
});
196196

197197
it('should create shift forms for each day of the week', () => {
198198
component.ngOnInit();
199-
199+
200200
const days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
201201
const firstShift = component.assignedSiteForm.get('firstShift');
202-
202+
203203
days.forEach(day => {
204204
expect(firstShift?.get(day)).toBeDefined();
205205
expect(firstShift?.get(day)?.get('start')).toBeDefined();
@@ -227,20 +227,20 @@ describe('AssignedSiteDialogComponent', () => {
227227
it('should copy break settings from global settings for monday', () => {
228228
// Reinitialize to get the new global settings
229229
component.ngOnInit();
230-
230+
231231
component.copyBreakSettings('monday');
232-
232+
233233
const mondayBreak = component.assignedSiteForm.get('autoBreakSettings')?.get('monday');
234-
expect(mondayBreak?.get('breakMinutesDivider')?.value).toBe(480);
235-
expect(mondayBreak?.get('breakMinutesPrDivider')?.value).toBe(30);
236-
expect(mondayBreak?.get('breakMinutesUpperLimit')?.value).toBe(60);
234+
expect(mondayBreak?.get('breakMinutesDivider')?.value).toBe('08:00');
235+
expect(mondayBreak?.get('breakMinutesPrDivider')?.value).toBe('00:30');
236+
expect(mondayBreak?.get('breakMinutesUpperLimit')?.value).toBe('01:00');
237237
});
238238

239239
it('should handle missing global settings gracefully', () => {
240240
component['globalAutoBreakSettings'] = null;
241-
241+
242242
component.copyBreakSettings('monday');
243-
243+
244244
// Should not throw error and should not modify values
245245
const mondayBreak = component.assignedSiteForm.get('autoBreakSettings')?.get('monday');
246246
expect(mondayBreak).toBeDefined();
@@ -250,39 +250,39 @@ describe('AssignedSiteDialogComponent', () => {
250250
describe('Data Change Detection', () => {
251251
it('should detect when data has changed', () => {
252252
component.ngOnInit();
253-
253+
254254
expect(component.hasDataChanged()).toBe(false);
255-
255+
256256
component.data.useGoogleSheetAsDefault = true;
257-
257+
258258
expect(component.hasDataChanged()).toBe(true);
259259
});
260260
});
261261

262262
describe('Time Field Update', () => {
263263
it('should set minutes correctly from time string', () => {
264264
component.ngOnInit();
265-
265+
266266
component.setMinutes('08:30', 'startMonday');
267-
267+
268268
expect(component.data['startMonday']).toBe(510); // 8*60 + 30
269269
});
270270

271271
it('should set minutes to 0 when empty value provided', () => {
272272
component.ngOnInit();
273273
component.data['startMonday'] = 480;
274-
274+
275275
component.setMinutes('', 'startMonday');
276-
276+
277277
expect(component.data['startMonday']).toBe(0);
278278
});
279279

280280
it('should handle different time formats', () => {
281281
component.ngOnInit();
282-
282+
283283
component.setMinutes('12:00', 'startMonday');
284284
expect(component.data['startMonday']).toBe(720); // 12*60
285-
285+
286286
component.setMinutes('00:30', 'endMonday');
287287
expect(component.data['endMonday']).toBe(30);
288288
});

0 commit comments

Comments
 (0)