Add comprehensive tests for vac-optimizer application
Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com>
This commit is contained in:
1 parent
f99db8b82d
commit
80a588741b
16 files changed
+385
-37
No files matched your search
@@ -1,11 +1,14 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { DateCacheService } from './date-cache.service';
|
||||
|
||||
describe('DateCacheService', () => {
|
||||
let service: DateCacheService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideZonelessChangeDetection()],
|
||||
});
|
||||
service = TestBed.inject(DateCacheService);
|
||||
});
|
||||
|
||||
@@ -43,4 +46,18 @@ describe('DateCacheService', () => {
|
||||
const year2 = service.getCurrentYear();
|
||||
expect(year1).toBe(year2); // Values should be the same even after clearing
|
||||
});
|
||||
|
||||
it('should return today with time normalized to 00:00:00.000', () => {
|
||||
const today = service.getToday();
|
||||
expect(today.getHours()).toBe(0);
|
||||
expect(today.getMinutes()).toBe(0);
|
||||
expect(today.getSeconds()).toBe(0);
|
||||
expect(today.getMilliseconds()).toBe(0);
|
||||
});
|
||||
|
||||
it('should return getNow() same as getToday()', () => {
|
||||
const now = service.getNow();
|
||||
const today = service.getToday();
|
||||
expect(now).toBe(today);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user