11import { TranslatePipe } from '@ngx-translate/core' ;
2+ import { MockPipe } from 'ng-mocks' ;
23
34import { Button } from 'primeng/button' ;
45import { Card } from 'primeng/card' ;
@@ -18,7 +19,12 @@ import { TokensListComponent } from './tokens-list.component';
1819jest . mock ( '@core/store/user' , ( ) => ( { } ) ) ;
1920jest . mock ( '@osf/shared/stores/collections' , ( ) => ( { } ) ) ;
2021jest . mock ( '@osf/shared/stores/addons' , ( ) => ( { } ) ) ;
21- jest . mock ( '@osf/features/settings/tokens/store' , ( ) => ( { } ) ) ;
22+ jest . mock ( '../../store' , ( ) => ( {
23+ TokensSelectors : {
24+ isTokensLoading : function isTokensLoading ( ) { } ,
25+ getTokens : function getTokens ( ) { } ,
26+ } ,
27+ } ) ) ;
2228
2329const mockGetTokens = jest . fn ( ) ;
2430const mockDeleteToken = jest . fn ( ( ) => of ( void 0 ) ) ;
@@ -31,9 +37,9 @@ jest.mock('@ngxs/store', () => {
3137 } ) ) ,
3238 select : ( selectorFn : any ) => {
3339 const name = selectorFn ?. name ;
34- if ( name === 'isTokensLoading' ) return of ( false ) ;
35- if ( name === 'getTokens' ) return of ( [ ] ) ;
36- return of ( undefined ) ;
40+ if ( name === 'isTokensLoading' ) return ( ) => false ;
41+ if ( name === 'getTokens' ) return ( ) => [ ] ;
42+ return ( ) => undefined ;
3743 } ,
3844 } ;
3945} ) ;
@@ -52,7 +58,7 @@ describe('TokensListComponent', () => {
5258
5359 beforeEach ( async ( ) => {
5460 await TestBed . configureTestingModule ( {
55- imports : [ TokensListComponent , TranslatePipe , Button , Card , Skeleton , RouterLink ] ,
61+ imports : [ TokensListComponent , MockPipe ( TranslatePipe ) , Button , Card , Skeleton , RouterLink ] ,
5662 providers : [
5763 { provide : CustomConfirmationService , useValue : mockConfirmationService } ,
5864 { provide : ToastService , useValue : mockToastService } ,
0 commit comments