@@ -9,6 +9,7 @@ let firebaseMock: FirebaseTools;
99
1010const  FIREBASE_PROJECT  =  'ikachu-aa3ef' ; 
1111const  PROJECT  =  'pirojok-project' ; 
12+ const  BUILD_TARGET  =  `${ PROJECT }  ; 
1213
1314describe ( 'Deploy Angular apps' ,  ( )  =>  { 
1415  beforeEach ( ( )  =>  initMocks ( ) ) ; 
@@ -21,7 +22,7 @@ describe('Deploy Angular apps', () => {
2122
2223  it ( 'should invoke the builder' ,  async  ( )  =>  { 
2324    const  spy  =  spyOn ( context ,  'scheduleTarget' ) . and . callThrough ( ) ; 
24-     await  deploy ( firebaseMock ,  context ,  'host' ,  FIREBASE_PROJECT ) ; 
25+     await  deploy ( firebaseMock ,  context ,  'host' ,  BUILD_TARGET ,   FIREBASE_PROJECT ) ; 
2526    expect ( spy ) . toHaveBeenCalled ( ) ; 
2627    expect ( spy ) . toHaveBeenCalledWith ( { 
2728      target : 'build' , 
@@ -30,9 +31,17 @@ describe('Deploy Angular apps', () => {
3031    } ) ; 
3132  } ) ; 
3233
34+   it ( 'should allow the buildTarget to be specified' ,  async  ( )  =>  { 
35+     const  buildTarget  =  `${ PROJECT }  ; 
36+     const  spy  =  spyOn ( context ,  'scheduleTarget' ) . and . callThrough ( ) ; 
37+     await  deploy ( firebaseMock ,  context ,  'host' ,  buildTarget ,  FIREBASE_PROJECT ) ; 
38+     expect ( spy ) . toHaveBeenCalled ( ) ; 
39+     expect ( spy ) . toHaveBeenCalledWith ( {  target : 'prerender' ,  project : PROJECT  } ) ; 
40+   } ) ; 
41+ 
3342  it ( 'should invoke firebase.deploy' ,  async  ( )  =>  { 
3443    const  spy  =  spyOn ( firebaseMock ,  'deploy' ) . and . callThrough ( ) ; 
35-     await  deploy ( firebaseMock ,  context ,  'host' ,  FIREBASE_PROJECT ) ; 
44+     await  deploy ( firebaseMock ,  context ,  'host' ,  BUILD_TARGET ,   FIREBASE_PROJECT ) ; 
3645    expect ( spy ) . toHaveBeenCalled ( ) ; 
3746    expect ( spy ) . toHaveBeenCalledWith ( { 
3847      cwd : 'host' ,  only : 'hosting:'  +  PROJECT 
@@ -42,7 +51,7 @@ describe('Deploy Angular apps', () => {
4251  describe ( 'error handling' ,   ( )  =>  { 
4352    it ( 'throws if there is no firebase project' ,  async  ( )  =>  { 
4453      try  { 
45-         await  deploy ( firebaseMock ,  context ,  'host' ) 
54+         await  deploy ( firebaseMock ,  context ,  'host' ,   BUILD_TARGET ) 
4655        fail ( ) ; 
4756      }  catch  ( e )  { 
4857        expect ( e . message ) . toMatch ( / C a n n o t   f i n d   f i r e b a s e   p r o j e c t / ) ; 
@@ -52,7 +61,7 @@ describe('Deploy Angular apps', () => {
5261    it ( 'throws if there is no target project' ,  async  ( )  =>  { 
5362      context . target  =  undefined ; 
5463      try  { 
55-         await  deploy ( firebaseMock ,  context ,  'host' ,  FIREBASE_PROJECT ) 
64+         await  deploy ( firebaseMock ,  context ,  'host' ,  BUILD_TARGET ,   FIREBASE_PROJECT ) 
5665        fail ( ) ; 
5766      }  catch  ( e )  { 
5867        expect ( e . message ) . toMatch ( / C a n n o t   e x e c u t e   t h e   b u i l d   t a r g e t / ) ; 
@@ -94,4 +103,4 @@ const initMocks = () => {
94103    scheduleBuilder : ( _ : string ,  __ ?: JsonObject ,  ___ ?: ScheduleOptions )  =>  Promise . resolve ( { }  as  BuilderRun ) , 
95104    scheduleTarget : ( _ : Target ,  __ ?: JsonObject ,  ___ ?: ScheduleOptions )  =>  Promise . resolve ( { }  as  BuilderRun ) 
96105  } ; 
97- } ; 
106+ } ; 
0 commit comments