1- import { Store } from '@ngxs/store' ;
2-
31import { MockComponent } from 'ng-mocks' ;
42
5- import { of } from 'rxjs' ;
6-
7- import { signal } from '@angular/core' ;
83import { ComponentFixture , TestBed } from '@angular/core/testing' ;
94
105import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component' ;
6+ import { SEARCH_TAB_OPTIONS } from '@osf/shared/constants/search-tab-options.const' ;
117
128import { SearchComponent } from './search.component' ;
139
14- describe . skip ( 'SearchComponent' , ( ) => {
10+ describe ( 'SearchComponent' , ( ) => {
1511 let component : SearchComponent ;
1612 let fixture : ComponentFixture < SearchComponent > ;
17- let store : Store ;
1813
1914 beforeEach ( async ( ) => {
2015 await TestBed . configureTestingModule ( {
2116 imports : [ SearchComponent , MockComponent ( GlobalSearchComponent ) ] ,
22- providers : [ ] ,
2317 } ) . compileComponents ( ) ;
2418
25- store = TestBed . inject ( Store ) ;
26- jest . spyOn ( store , 'selectSignal' ) . mockReturnValue ( signal ( '' ) ) ;
27- jest . spyOn ( store , 'dispatch' ) . mockReturnValue ( of ( undefined ) ) ;
28-
2919 fixture = TestBed . createComponent ( SearchComponent ) ;
3020 component = fixture . componentInstance ;
3121 fixture . detectChanges ( ) ;
@@ -34,4 +24,17 @@ describe.skip('SearchComponent', () => {
3424 it ( 'should create' , ( ) => {
3525 expect ( component ) . toBeTruthy ( ) ;
3626 } ) ;
27+
28+ it ( 'should initialize searchTabOptions with SEARCH_TAB_OPTIONS' , ( ) => {
29+ expect ( component . searchTabOptions ) . toEqual ( SEARCH_TAB_OPTIONS ) ;
30+ } ) ;
31+
32+ it ( 'should render template with correct structure' , ( ) => {
33+ const hostElement = fixture . debugElement . nativeElement ;
34+ const containerDiv = hostElement . querySelector ( 'div.mt-6.pt-5' ) ;
35+ expect ( containerDiv ) . toBeTruthy ( ) ;
36+
37+ const globalSearch = containerDiv . querySelector ( 'osf-global-search' ) ;
38+ expect ( globalSearch ) . toBeTruthy ( ) ;
39+ } ) ;
3740} ) ;
0 commit comments