mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-16 00:19:32 -06:00
Feature: global search, keyboard shortcuts / hotkey support (#6449)
This commit is contained in:
@@ -6,10 +6,13 @@ import { Subscription } from 'rxjs'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { SearchService } from './search.service'
|
||||
import { SettingsService } from '../settings.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: SearchService
|
||||
let subscription: Subscription
|
||||
let settingsService: SettingsService
|
||||
const endpoint = 'search/autocomplete'
|
||||
|
||||
describe('SearchService', () => {
|
||||
@@ -20,6 +23,7 @@ describe('SearchService', () => {
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
settingsService = TestBed.inject(SettingsService)
|
||||
service = TestBed.inject(SearchService)
|
||||
})
|
||||
|
||||
@@ -36,4 +40,18 @@ describe('SearchService', () => {
|
||||
)
|
||||
expect(req.request.method).toEqual('GET')
|
||||
})
|
||||
|
||||
it('should call correct api endpoint on globalSearch', () => {
|
||||
const query = 'apple'
|
||||
service.globalSearch(query).subscribe()
|
||||
httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}search/?query=${query}`
|
||||
)
|
||||
|
||||
settingsService.set(SETTINGS_KEYS.SEARCH_DB_ONLY, true)
|
||||
subscription = service.globalSearch(query).subscribe()
|
||||
httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}search/?query=${query}&db_only=true`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user