@@ -22,8 +22,7 @@ describe("apphosting rollouts", () => {
2222 const gitRepoLinkId = `${ user } -${ repo } ` ;
2323 const buildAndRolloutId = "build-2024-10-01-001" ;
2424
25- let getBackendForLocationStub : sinon . SinonStub ;
26- let getBackendForAmbiguousLocationStub : sinon . SinonStub ;
25+ let getBackend : sinon . SinonStub ;
2726 let getRepoDetailsFromBackendStub : sinon . SinonStub ;
2827 let listAllBranchesStub : sinon . SinonStub ;
2928 let getGitHubBranchStub : sinon . SinonStub ;
@@ -36,12 +35,7 @@ describe("apphosting rollouts", () => {
3635 let sleepStub : sinon . SinonStub ;
3736
3837 beforeEach ( ( ) => {
39- getBackendForLocationStub = sinon
40- . stub ( backend , "getBackendForLocation" )
41- . throws ( "unexpected getBackendForLocation call" ) ;
42- getBackendForAmbiguousLocationStub = sinon
43- . stub ( backend , "getBackendForAmbiguousLocation" )
44- . throws ( "unexpected getBackendForAmbiguousLocation call" ) ;
38+ getBackend = sinon . stub ( backend , "getBackend" ) . throws ( "unexpected getBackend call" ) ;
4539 getRepoDetailsFromBackendStub = sinon
4640 . stub ( devConnect , "getRepoDetailsFromBackend" )
4741 . throws ( "unexpected getRepoDetailsFromBackend call" ) ;
@@ -149,8 +143,7 @@ describe("apphosting rollouts", () => {
149143
150144 describe ( "createRollout" , ( ) => {
151145 it ( "should create a new rollout from user-specified branch" , async ( ) => {
152- getBackendForLocationStub . resolves ( backend ) ;
153- getBackendForAmbiguousLocationStub . resolves ( backend ) ;
146+ getBackend . resolves ( backend ) ;
154147 getRepoDetailsFromBackendStub . resolves ( repoLinkDetails ) ;
155148 listAllBranchesStub . resolves ( branches ) ;
156149 getGitHubBranchStub . resolves ( branchInfo ) ;
@@ -160,16 +153,15 @@ describe("apphosting rollouts", () => {
160153 pollOperationStub . onFirstCall ( ) . resolves ( rollout ) ;
161154 pollOperationStub . onSecondCall ( ) . resolves ( build ) ;
162155
163- await createRollout ( backendId , projectId , location , branchId , undefined , true ) ;
156+ await createRollout ( backendId , projectId , branchId , undefined , true ) ;
164157
165158 expect ( createBuildStub ) . to . be . called ;
166159 expect ( createRolloutStub ) . to . be . called ;
167160 expect ( pollOperationStub ) . to . be . called ;
168161 } ) ;
169162
170163 it ( "should create a new rollout from user-specified commit" , async ( ) => {
171- getBackendForLocationStub . resolves ( backend ) ;
172- getBackendForAmbiguousLocationStub . resolves ( backend ) ;
164+ getBackend . resolves ( backend ) ;
173165 getRepoDetailsFromBackendStub . resolves ( repoLinkDetails ) ;
174166 getGitHubCommitStub . resolves ( commitInfo ) ;
175167 getNextRolloutIdStub . resolves ( buildAndRolloutId ) ;
@@ -178,16 +170,15 @@ describe("apphosting rollouts", () => {
178170 pollOperationStub . onFirstCall ( ) . resolves ( rollout ) ;
179171 pollOperationStub . onSecondCall ( ) . resolves ( build ) ;
180172
181- await createRollout ( backendId , projectId , location , undefined , commitSha , true ) ;
173+ await createRollout ( backendId , projectId , undefined , commitSha , true ) ;
182174
183175 expect ( createBuildStub ) . to . be . called ;
184176 expect ( createRolloutStub ) . to . be . called ;
185177 expect ( pollOperationStub ) . to . be . called ;
186178 } ) ;
187179
188180 it ( "should prompt user for a branch if branch or commit ID is not specified" , async ( ) => {
189- getBackendForLocationStub . resolves ( backend ) ;
190- getBackendForAmbiguousLocationStub . resolves ( backend ) ;
181+ getBackend . resolves ( backend ) ;
191182 getRepoDetailsFromBackendStub . resolves ( repoLinkDetails ) ;
192183 promptGitHubBranchStub . resolves ( branchId ) ;
193184 getGitHubBranchStub . resolves ( branchInfo ) ;
@@ -197,7 +188,7 @@ describe("apphosting rollouts", () => {
197188 pollOperationStub . onFirstCall ( ) . resolves ( rollout ) ;
198189 pollOperationStub . onSecondCall ( ) . resolves ( build ) ;
199190
200- await createRollout ( backendId , projectId , location , undefined , undefined , false ) ;
191+ await createRollout ( backendId , projectId , undefined , undefined , false ) ;
201192
202193 expect ( promptGitHubBranchStub ) . to . be . called ;
203194 expect ( createBuildStub ) . to . be . called ;
@@ -206,33 +197,31 @@ describe("apphosting rollouts", () => {
206197 } ) ;
207198
208199 it ( "should throw an error if GitHub branch is not found" , async ( ) => {
209- getBackendForLocationStub . resolves ( backend ) ;
210- getBackendForAmbiguousLocationStub . resolves ( backend ) ;
200+ getBackend . resolves ( backend ) ;
211201 getRepoDetailsFromBackendStub . resolves ( repoLinkDetails ) ;
212202 listAllBranchesStub . resolves ( branches ) ;
213203
214204 await expect (
215- createRollout ( backendId , projectId , location , "invalid-branch" , undefined , true ) ,
205+ createRollout ( backendId , projectId , "invalid-branch" , undefined , true ) ,
216206 ) . to . be . rejectedWith ( / U n r e c o g n i z e d g i t b r a n c h / ) ;
217207 } ) ;
218208
219209 it ( "should throw an error if GitHub commit is not found" , async ( ) => {
220- getBackendForLocationStub . resolves ( backend ) ;
221- getBackendForAmbiguousLocationStub . resolves ( backend ) ;
210+ getBackend . resolves ( backend ) ;
222211 getRepoDetailsFromBackendStub . resolves ( repoLinkDetails ) ;
223212 getGitHubCommitStub . rejects ( new FirebaseError ( "error" , { status : 422 } ) ) ;
224213
225214 await expect (
226- createRollout ( backendId , projectId , location , undefined , commitSha , true ) ,
215+ createRollout ( backendId , projectId , undefined , commitSha , true ) ,
227216 ) . to . be . rejectedWith ( / U n r e c o g n i z e d g i t c o m m i t / ) ;
228217 } ) ;
229218
230219 it ( "should throw an error if --force flag is specified but --git-branch and --git-commit are missing" , async ( ) => {
231- getBackendForLocationStub . resolves ( backend ) ;
220+ getBackend . resolves ( backend ) ;
232221 getRepoDetailsFromBackendStub . resolves ( repoLinkDetails ) ;
233222
234223 await expect (
235- createRollout ( backendId , projectId , location , undefined , undefined , true ) ,
224+ createRollout ( backendId , projectId , undefined , undefined , true ) ,
236225 ) . to . be . rejectedWith ( / F a i l e d t o c r e a t e r o l l o u t w i t h - - f o r c e o p t i o n / ) ;
237226 } ) ;
238227 } ) ;
0 commit comments