Task Summary
Create search-bar.component.spec.ts for frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts.
Behavior to cover:
- isLogin tracking — initial value comes from UserService.isLogin(); updates when userChanged() emits.
- onSearchInputChange — clears listOfResult immediately for empty query; for non-empty pushes through searchSubject.
- Debouncing — searchSubject emits go through debounceTime(200) (use fakeAsync + tick) and then getSearchResults.
- getSearchResults caching — first call invokes SearchService.search([query], params, 0, 5, null, SortMethod.NameAsc, isLogin, includePublic=true); subsequent calls with same query return cached
result without re-invoking service.
- Cache eviction (addToCache) — once 20 queries are cached, adding a 21st evicts the oldest (queryOrder.shift() + searchCache.delete).
- convertToName — returns correct DashboardEntry.name for workflow, project, file, dataset items; throws "Unexpected type in SearchResult." otherwise.
- performSearch — navigates to DASHBOARD_SEARCH with queryParams: { q: keyword }.
Task Type
Task Summary
Create search-bar.component.spec.ts for frontend/src/app/dashboard/component/user/search-bar/search-bar.component.ts.
Behavior to cover:
result without re-invoking service.
Task Type