mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-04 00:31:12 -06:00
Fixhancement: truncate large logs, improve auto-scroll (#11239)
This commit is contained in:
@@ -67,7 +67,7 @@ describe('LogsComponent', () => {
|
||||
})
|
||||
|
||||
it('should display logs with first log initially', () => {
|
||||
expect(logSpy).toHaveBeenCalledWith('paperless')
|
||||
expect(logSpy).toHaveBeenCalledWith('paperless', 5000)
|
||||
fixture.detectChanges()
|
||||
expect(fixture.debugElement.nativeElement.textContent).toContain(
|
||||
paperless_logs[0]
|
||||
@@ -78,7 +78,7 @@ describe('LogsComponent', () => {
|
||||
fixture.debugElement
|
||||
.queryAll(By.directive(NgbNavLink))[1]
|
||||
.nativeElement.dispatchEvent(new MouseEvent('click'))
|
||||
expect(logSpy).toHaveBeenCalledWith('mail')
|
||||
expect(logSpy).toHaveBeenCalledWith('mail', 5000)
|
||||
})
|
||||
|
||||
it('should handle error with no logs', () => {
|
||||
@@ -101,4 +101,13 @@ describe('LogsComponent', () => {
|
||||
jest.advanceTimersByTime(6000)
|
||||
expect(reloadSpy).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('should debounce limit changes before reloading logs', () => {
|
||||
const initialCalls = reloadSpy.mock.calls.length
|
||||
component.onLimitChange(6000)
|
||||
jest.advanceTimersByTime(299)
|
||||
expect(reloadSpy).toHaveBeenCalledTimes(initialCalls)
|
||||
jest.advanceTimersByTime(1)
|
||||
expect(reloadSpy).toHaveBeenCalledTimes(initialCalls + 1)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user