File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,15 @@ describe("distribution", () => {
169169 } ) ;
170170 expect ( nock . isDone ( ) ) . to . be . true ;
171171 } ) ;
172+
173+ it ( "should gracefully handle no testers" , async ( ) => {
174+ nock ( appDistributionOrigin ( ) ) . get ( `/v1/${ projectName } /testers` ) . reply ( 200 , { } ) ;
175+
176+ await expect ( appDistributionClient . listTesters ( projectName ) ) . to . eventually . deep . eq ( {
177+ testers : [ ] ,
178+ } ) ;
179+ expect ( nock . isDone ( ) ) . to . be . true ;
180+ } ) ;
172181 } ) ;
173182
174183 describe ( "uploadRelease" , ( ) => {
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ export class AppDistributionClient {
152152 throw new FirebaseError ( `Client request failed to list testers ${ err } ` ) ;
153153 }
154154
155- for ( const t of apiResponse . body . testers ) {
155+ for ( const t of apiResponse . body . testers ?? [ ] ) {
156156 listTestersResponse . testers . push ( {
157157 name : t . name ,
158158 displayName : t . displayName ,
@@ -212,7 +212,7 @@ export class AppDistributionClient {
212212 const apiResponse = await client . get < ListGroupsResponse > ( `${ projectName } /groups` , {
213213 queryParams,
214214 } ) ;
215- listGroupsResponse . groups . push ( ...( apiResponse . body . groups || [ ] ) ) ;
215+ listGroupsResponse . groups . push ( ...( apiResponse . body . groups ?? [ ] ) ) ;
216216 pageToken = apiResponse . body . nextPageToken ;
217217 } catch ( err ) {
218218 throw new FirebaseError ( `Client failed to list groups ${ err } ` ) ;
You can’t perform that action at this time.
0 commit comments