mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
fix(core): treat empty/whitespace serverTimeUrl as not configured in TimeSyncService
This commit is contained in:
@@ -260,6 +260,16 @@ describe('TimeSyncService', () => {
|
|||||||
httpMock.expectNone('http://fake-server-time-url');
|
httpMock.expectNone('http://fake-server-time-url');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should complete silently when serverTimeUrl is whitespace only', () => {
|
||||||
|
appConfigSpy.get.and.returnValue(' ');
|
||||||
|
|
||||||
|
service.syncClockOffset().subscribe(() => {
|
||||||
|
expect(service.clockOffsetMs).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
httpMock.expectNone('http://fake-server-time-url');
|
||||||
|
});
|
||||||
|
|
||||||
it('should leave clockOffsetMs unchanged when the server time endpoint fails', () => {
|
it('should leave clockOffsetMs unchanged when the server time endpoint fails', () => {
|
||||||
appConfigSpy.get.and.returnValue('http://fake-server-time-url');
|
appConfigSpy.get.and.returnValue('http://fake-server-time-url');
|
||||||
service.clockOffsetMs = 5000;
|
service.clockOffsetMs = 5000;
|
||||||
|
|||||||
@@ -249,6 +249,6 @@ export class TimeSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getServerTimeUrl(): string {
|
private getServerTimeUrl(): string {
|
||||||
return this._appConfigService.get('serverTimeUrl', '');
|
return this._appConfigService.get('serverTimeUrl', '').trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user