77import { ActivatedRoute } from '@angular/router' ;
88import { TranslateModule } from '@ngx-translate/core' ;
99import { of as observableOf } from 'rxjs' ;
10+ import { ServerResponseService } from 'src/app/core/services/server-response.service' ;
1011
1112import { ActivatedRouteStub } from '../../shared/testing/active-router.stub' ;
1213import { ObjectNotFoundComponent } from './objectnotfound.component' ;
@@ -21,6 +22,10 @@ describe('ObjectNotFoundComponent', () => {
2122 const activatedRouteStub = Object . assign ( new ActivatedRouteStub ( ) , {
2223 params : observableOf ( { id : testUUID , idType : uuidType } ) ,
2324 } ) ;
25+ const serverResponseServiceStub = jasmine . createSpyObj ( 'ServerResponseService' , {
26+ setNotFound : jasmine . createSpy ( 'setNotFound' ) ,
27+ } ) ;
28+
2429 const activatedRouteStubHandle = Object . assign ( new ActivatedRouteStub ( ) , {
2530 params : observableOf ( { id : handleId , idType : handlePrefix } ) ,
2631 } ) ;
@@ -31,6 +36,7 @@ describe('ObjectNotFoundComponent', () => {
3136 TranslateModule . forRoot ( ) ,
3237 ObjectNotFoundComponent ,
3338 ] , providers : [
39+ { provide : ServerResponseService , useValue : serverResponseServiceStub } ,
3440 { provide : ActivatedRoute , useValue : activatedRouteStub } ,
3541 ] ,
3642 schemas : [ NO_ERRORS_SCHEMA ] ,
@@ -52,6 +58,10 @@ describe('ObjectNotFoundComponent', () => {
5258 expect ( comp . idType ) . toEqual ( uuidType ) ;
5359 expect ( comp . missingItem ) . toEqual ( 'uuid: ' + testUUID ) ;
5460 } ) ;
61+
62+ it ( 'should call serverResponseService.setNotFound' , ( ) => {
63+ expect ( serverResponseServiceStub . setNotFound ) . toHaveBeenCalled ( ) ;
64+ } ) ;
5565 } ) ;
5666
5767 describe ( 'legacy handle request' , ( ) => {
@@ -61,6 +71,7 @@ describe('ObjectNotFoundComponent', () => {
6171 TranslateModule . forRoot ( ) ,
6272 ObjectNotFoundComponent ,
6373 ] , providers : [
74+ { provide : ServerResponseService , useValue : serverResponseServiceStub } ,
6475 { provide : ActivatedRoute , useValue : activatedRouteStubHandle } ,
6576 ] ,
6677 schemas : [ NO_ERRORS_SCHEMA ] ,
@@ -78,6 +89,10 @@ describe('ObjectNotFoundComponent', () => {
7889 expect ( comp . idType ) . toEqual ( handlePrefix ) ;
7990 expect ( comp . missingItem ) . toEqual ( 'handle: ' + handlePrefix + '/' + handleId ) ;
8091 } ) ;
92+
93+ it ( 'should call serverResponseService.setNotFound' , ( ) => {
94+ expect ( serverResponseServiceStub . setNotFound ) . toHaveBeenCalled ( ) ;
95+ } ) ;
8196 } ) ;
8297
8398} ) ;
0 commit comments