@@ -157,19 +157,17 @@ suite("cloud/ui/pickers", () => {
157157
158158 suite ( "pickTeam" , ( ) => {
159159 test ( "auto-selects when only one team" , async ( ) => {
160- const api = mockApiService ( {
161- getTeams : sinon . stub ( ) . resolves ( [ team1 ] ) ,
162- } )
160+ const api = mockApiService ( )
161+ api . getTeams . resolves ( [ team1 ] )
163162
164163 const result = await pickTeam ( api )
165164
166165 assert . deepStrictEqual ( result , team1 )
167166 } )
168167
169168 test ( "shows quick pick when multiple teams" , async ( ) => {
170- const api = mockApiService ( {
171- getTeams : sinon . stub ( ) . resolves ( [ team1 , team2 ] ) ,
172- } )
169+ const api = mockApiService ( )
170+ api . getTeams . resolves ( [ team1 , team2 ] )
173171
174172 sinon
175173 . stub ( ui , "showQuickPick" )
@@ -191,9 +189,8 @@ suite("cloud/ui/pickers", () => {
191189 } )
192190
193191 test ( "returns null on fetch error" , async ( ) => {
194- const api = mockApiService ( {
195- getTeams : sinon . stub ( ) . rejects ( new Error ( "Network error" ) ) ,
196- } )
192+ const api = mockApiService ( )
193+ api . getTeams . rejects ( new Error ( "Network error" ) )
197194 const errorStub = sinon . stub ( ui , "showErrorMessage" )
198195
199196 const result = await pickTeam ( api )
@@ -203,9 +200,8 @@ suite("cloud/ui/pickers", () => {
203200 } )
204201
205202 test ( "returns null when user cancels" , async ( ) => {
206- const api = mockApiService ( {
207- getTeams : sinon . stub ( ) . resolves ( [ team1 , team2 ] ) ,
208- } )
203+ const api = mockApiService ( )
204+ api . getTeams . resolves ( [ team1 , team2 ] )
209205
210206 sinon . stub ( ui , "showQuickPick" ) . resolves ( undefined )
211207
@@ -217,9 +213,8 @@ suite("cloud/ui/pickers", () => {
217213
218214 suite ( "pickExistingApp" , ( ) => {
219215 test ( "shows apps and returns selection" , async ( ) => {
220- const api = mockApiService ( {
221- getApps : sinon . stub ( ) . resolves ( [ app1 , app2 ] ) ,
222- } )
216+ const api = mockApiService ( )
217+ api . getApps . resolves ( [ app1 , app2 ] )
223218
224219 sinon
225220 . stub ( vscode . window , "showQuickPick" )
@@ -241,9 +236,8 @@ suite("cloud/ui/pickers", () => {
241236 } )
242237
243238 test ( "returns null on fetch error" , async ( ) => {
244- const api = mockApiService ( {
245- getApps : sinon . stub ( ) . rejects ( new Error ( "Network error" ) ) ,
246- } )
239+ const api = mockApiService ( )
240+ api . getApps . rejects ( new Error ( "Network error" ) )
247241 const errorStub = sinon . stub ( ui , "showErrorMessage" )
248242
249243 const result = await pickExistingApp ( api , team1 )
@@ -253,9 +247,8 @@ suite("cloud/ui/pickers", () => {
253247 } )
254248
255249 test ( "returns null when user cancels" , async ( ) => {
256- const api = mockApiService ( {
257- getApps : sinon . stub ( ) . resolves ( [ app1 ] ) ,
258- } )
250+ const api = mockApiService ( )
251+ api . getApps . resolves ( [ app1 ] )
259252
260253 sinon . stub ( ui , "showQuickPick" ) . resolves ( undefined )
261254
@@ -268,9 +261,8 @@ suite("cloud/ui/pickers", () => {
268261 suite ( "createNewApp" , ( ) => {
269262 test ( "creates app with valid name" , async ( ) => {
270263 const createdApp = { id : "a3" , slug : "my-app" , url : "" , team_id : "t1" }
271- const api = mockApiService ( {
272- createApp : sinon . stub ( ) . resolves ( createdApp ) ,
273- } )
264+ const api = mockApiService ( )
265+ api . createApp . resolves ( createdApp )
274266
275267 sinon . stub ( vscode . window , "showInputBox" ) . resolves ( "my-app" )
276268
@@ -316,9 +308,8 @@ suite("cloud/ui/pickers", () => {
316308 } )
317309
318310 test ( "returns null on API error" , async ( ) => {
319- const api = mockApiService ( {
320- createApp : sinon . stub ( ) . rejects ( new Error ( "Already exists" ) ) ,
321- } )
311+ const api = mockApiService ( )
312+ api . createApp . rejects ( new Error ( "Already exists" ) )
322313
323314 sinon . stub ( vscode . window , "showInputBox" ) . resolves ( "my-app" )
324315 const errorStub = sinon . stub ( ui , "showErrorMessage" )
0 commit comments