@@ -6,6 +6,7 @@ import { ObjectNotFoundComponent } from './objectnotfound.component';
66import { ActivatedRouteStub } from '../../shared/testing/active-router.stub' ;
77import { of as observableOf } from 'rxjs' ;
88import { ActivatedRoute } from '@angular/router' ;
9+ import { ServerResponseService } from 'src/app/core/services/server-response.service' ;
910
1011describe ( 'ObjectNotFoundComponent' , ( ) => {
1112 let comp : ObjectNotFoundComponent ;
@@ -17,6 +18,10 @@ describe('ObjectNotFoundComponent', () => {
1718 const activatedRouteStub = Object . assign ( new ActivatedRouteStub ( ) , {
1819 params : observableOf ( { id : testUUID , idType : uuidType } )
1920 } ) ;
21+ const serverResponseServiceStub = jasmine . createSpyObj ( 'ServerResponseService' , {
22+ setNotFound : jasmine . createSpy ( 'setNotFound' )
23+ } ) ;
24+
2025 const activatedRouteStubHandle = Object . assign ( new ActivatedRouteStub ( ) , {
2126 params : observableOf ( { id : handleId , idType : handlePrefix } )
2227 } ) ;
@@ -26,6 +31,7 @@ describe('ObjectNotFoundComponent', () => {
2631 imports : [
2732 TranslateModule . forRoot ( )
2833 ] , providers : [
34+ { provide : ServerResponseService , useValue : serverResponseServiceStub } ,
2935 { provide : ActivatedRoute , useValue : activatedRouteStub }
3036 ] ,
3137 declarations : [ ObjectNotFoundComponent ] ,
@@ -48,6 +54,10 @@ describe('ObjectNotFoundComponent', () => {
4854 expect ( comp . idType ) . toEqual ( uuidType ) ;
4955 expect ( comp . missingItem ) . toEqual ( 'uuid: ' + testUUID ) ;
5056 } ) ;
57+
58+ it ( 'should call serverResponseService.setNotFound' , ( ) => {
59+ expect ( serverResponseServiceStub . setNotFound ) . toHaveBeenCalled ( ) ;
60+ } ) ;
5161 } ) ;
5262
5363 describe ( 'legacy handle request' , ( ) => {
@@ -56,6 +66,7 @@ describe('ObjectNotFoundComponent', () => {
5666 imports : [
5767 TranslateModule . forRoot ( )
5868 ] , providers : [
69+ { provide : ServerResponseService , useValue : serverResponseServiceStub } ,
5970 { provide : ActivatedRoute , useValue : activatedRouteStubHandle }
6071 ] ,
6172 declarations : [ ObjectNotFoundComponent ] ,
@@ -74,6 +85,9 @@ describe('ObjectNotFoundComponent', () => {
7485 expect ( comp . idType ) . toEqual ( handlePrefix ) ;
7586 expect ( comp . missingItem ) . toEqual ( 'handle: ' + handlePrefix + '/' + handleId ) ;
7687 } ) ;
77- } ) ;
7888
89+ it ( 'should call serverResponseService.setNotFound' , ( ) => {
90+ expect ( serverResponseServiceStub . setNotFound ) . toHaveBeenCalled ( ) ;
91+ } ) ;
92+ } ) ;
7993} ) ;
0 commit comments