@@ -150,7 +150,7 @@ suite('Insiders Extension Service - Activation', () => {
150
150
verify ( extensionChannelService . isChannelUsingDefaultConfiguration ) . once ( ) ;
151
151
assert . ok ( registerCommandsAndHandlers . calledOnce ) ;
152
152
assert . ok ( handleEdgeCases . calledOnce ) ;
153
- assert . ok ( handleEdgeCases . calledWith ( 'daily' , false ) ) ;
153
+ assert . ok ( handleEdgeCases . calledWith ( false ) ) ;
154
154
assert . ok ( handleChannel . notCalled ) ;
155
155
} ) ;
156
156
@@ -176,7 +176,7 @@ suite('Insiders Extension Service - Activation', () => {
176
176
verify ( extensionChannelService . isChannelUsingDefaultConfiguration ) . once ( ) ;
177
177
assert . ok ( registerCommandsAndHandlers . calledOnce ) ;
178
178
assert . ok ( handleEdgeCases . calledOnce ) ;
179
- assert . ok ( handleEdgeCases . calledWith ( 'daily' , false ) ) ;
179
+ assert . ok ( handleEdgeCases . calledWith ( false ) ) ;
180
180
assert . ok ( handleChannel . calledOnce ) ;
181
181
} ) ;
182
182
@@ -210,7 +210,7 @@ suite('Insiders Extension Service - Activation', () => {
210
210
assert . ok ( registerCommandsAndHandlers . calledOnce ) ;
211
211
assert . ok ( handleEdgeCases . calledOnce ) ;
212
212
assert . ok ( handleChannel . calledOnce ) ;
213
- assert . ok ( handleEdgeCases . calledWith ( 'daily' , false ) ) ;
213
+ assert . ok ( handleEdgeCases . calledWith ( false ) ) ;
214
214
} ) ;
215
215
} ) ;
216
216
@@ -252,6 +252,10 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => {
252
252
. verifiable ( TypeMoq . Times . atLeast ( 0 ) ) ;
253
253
}
254
254
255
+ setup ( ( ) => {
256
+ setupCommon ( ) ;
257
+ } ) ;
258
+
255
259
function verifyAll ( ) {
256
260
// the most important ones:
257
261
insidersPrompt . verifyAll ( ) ;
@@ -265,23 +269,16 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => {
265
269
266
270
type TestInfo = {
267
271
vscodeChannel ?: Channel ;
268
- extensionChannel ?: Channel ;
269
- installChannel : ExtensionChannels ;
272
+ installChannel ?: ExtensionChannels ;
270
273
isChannelUsingDefaultConfiguration ?: boolean ;
271
274
hasUserBeenNotified ?: boolean ;
272
275
} ;
273
276
274
- function setState ( info : TestInfo , checkPromptEnroll : boolean , checkDisable : boolean ) {
277
+ function setState ( info : TestInfo , checkPromptEnroll : boolean ) {
275
278
if ( info . vscodeChannel ) {
276
279
appEnvironment . setup ( ( e ) => e . channel ) . returns ( ( ) => info . vscodeChannel ! ) ;
277
280
}
278
- if ( info . extensionChannel ) {
279
- appEnvironment . setup ( ( e ) => e . extensionChannel ) . returns ( ( ) => info . extensionChannel ! ) ;
280
- }
281
281
282
- if ( checkDisable ) {
283
- extensionChannelService . setup ( ( ec ) => ec . updateChannel ( 'off' ) ) . returns ( ( ) => Promise . resolve ( ) ) ;
284
- }
285
282
if ( info . hasUserBeenNotified !== undefined ) {
286
283
when ( hasUserBeenNotifiedState . value ) . thenReturn ( info . hasUserBeenNotified ! ) ;
287
284
}
@@ -290,125 +287,42 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => {
290
287
}
291
288
}
292
289
293
- suite ( 'Case II - Verify Insiders Install Prompt is displayed when conditions are met' , async ( ) => {
294
- const testsForHandleEdgeCaseII : TestInfo [ ] = [
290
+ test ( ` Insiders Install Prompt is displayed when vscode channel = 'insiders', user has not been notified to install insiders, isChannelUsingDefaultConfiguration = true` , async ( ) => {
291
+ setState (
295
292
{
296
- installChannel : 'daily' ,
297
293
// prompt to enroll
298
294
vscodeChannel : 'insiders' ,
299
295
hasUserBeenNotified : false ,
300
296
isChannelUsingDefaultConfiguration : true
301
297
} ,
302
- {
303
- installChannel : 'off' ,
304
- // prompt to enroll
305
- vscodeChannel : 'insiders' ,
306
- hasUserBeenNotified : false ,
307
- isChannelUsingDefaultConfiguration : true
308
- }
309
- ] ;
310
-
311
- setup ( ( ) => {
312
- setupCommon ( ) ;
313
- } ) ;
314
-
315
- testsForHandleEdgeCaseII . forEach ( ( testParams ) => {
316
- const testName = `Insiders Install Prompt is displayed when vscode channel = '${
317
- testParams . vscodeChannel
318
- } ', extension channel = '${ testParams . extensionChannel } ', install channel = '${
319
- testParams . installChannel
320
- } ', ${
321
- ! testParams . hasUserBeenNotified
322
- ? 'user has not been notified to install insiders'
323
- : 'user has already been notified to install insiders'
324
- } , isChannelUsingDefaultConfiguration = ${ testParams . isChannelUsingDefaultConfiguration } `;
325
- test ( testName , async ( ) => {
326
- setState ( testParams , true , false ) ;
327
-
328
- await insidersExtensionService . handleEdgeCases (
329
- testParams . installChannel ,
330
- testParams . isChannelUsingDefaultConfiguration !
331
- ) ;
332
-
333
- verifyAll ( ) ;
334
- verify ( hasUserBeenNotifiedState . value ) . once ( ) ;
335
- } ) ;
336
- } ) ;
337
- } ) ;
338
-
339
- suite ( 'Case III - Verify Insiders channel is set to off when conditions are met' , async ( ) => {
340
- const testsForHandleEdgeCaseIII : TestInfo [ ] = [
341
- {
342
- installChannel : 'daily' ,
343
- // skip enroll
344
- vscodeChannel : 'stable' ,
345
- // disable
346
- // with installChannel from above
347
- extensionChannel : 'stable'
348
- } ,
349
- {
350
- installChannel : 'weekly' ,
351
- // skip enroll
352
- vscodeChannel : 'stable' ,
353
- // disable
354
- // with installChannel from above
355
- extensionChannel : 'stable'
356
- }
357
- ] ;
358
-
359
- setup ( ( ) => {
360
- setupCommon ( ) ;
361
- } ) ;
298
+ true
299
+ ) ;
362
300
363
- testsForHandleEdgeCaseIII . forEach ( ( testParams ) => {
364
- const testName = `Insiders channel is set to off when vscode channel = '${
365
- testParams . vscodeChannel
366
- } ', extension channel = '${ testParams . extensionChannel } ', install channel = '${
367
- testParams . installChannel
368
- } ', ${
369
- ! testParams . hasUserBeenNotified
370
- ? 'user has not been notified to install insiders'
371
- : 'user has already been notified to install insiders'
372
- } , isChannelUsingDefaultConfiguration = ${ testParams . isChannelUsingDefaultConfiguration } `;
373
- test ( testName , async ( ) => {
374
- setState ( testParams , false , true ) ;
301
+ await insidersExtensionService . handleEdgeCases ( true ) ;
375
302
376
- await insidersExtensionService . handleEdgeCases (
377
- testParams . installChannel ,
378
- false // isDefault
379
- ) ;
380
-
381
- verifyAll ( ) ;
382
- verify ( hasUserBeenNotifiedState . value ) . never ( ) ;
383
- } ) ;
384
- } ) ;
303
+ verifyAll ( ) ;
304
+ verify ( hasUserBeenNotifiedState . value ) . once ( ) ;
385
305
} ) ;
386
306
387
- suite ( 'Case IV - Verify no operation is performed if none of the case conditions are met' , async ( ) => {
388
- const testsForHandleEdgeCaseIV : TestInfo [ ] = [
307
+ suite ( 'Verify no operation is performed if none of the case conditions are met' , async ( ) => {
308
+ const testsForHandleEdgeCases : TestInfo [ ] = [
389
309
{
390
310
installChannel : 'daily' ,
391
311
// skip enroll
392
312
vscodeChannel : 'insiders' ,
393
- hasUserBeenNotified : true ,
394
- // skip disable
395
- extensionChannel : 'insiders'
313
+ hasUserBeenNotified : true
396
314
} ,
397
315
{
398
316
installChannel : 'daily' ,
399
317
// skip enroll
400
318
vscodeChannel : 'insiders' ,
401
319
hasUserBeenNotified : false ,
402
- isChannelUsingDefaultConfiguration : false ,
403
- // skip disable
404
- extensionChannel : 'insiders'
320
+ isChannelUsingDefaultConfiguration : false
405
321
} ,
406
322
{
407
323
installChannel : 'daily' ,
408
324
// skip enroll
409
- vscodeChannel : 'stable' ,
410
- // skip disable
411
- extensionChannel : 'insiders'
325
+ vscodeChannel : 'stable'
412
326
} ,
413
327
{
414
328
installChannel : 'off' ,
@@ -436,21 +350,18 @@ suite('Insiders Extension Service - Function handleEdgeCases()', () => {
436
350
setupCommon ( ) ;
437
351
} ) ;
438
352
439
- testsForHandleEdgeCaseIV . forEach ( ( testParams ) => {
353
+ testsForHandleEdgeCases . forEach ( ( testParams ) => {
440
354
const testName = `No operation is performed when vscode channel = '${
441
355
testParams . vscodeChannel
442
- } ', extension channel = '${ testParams . extensionChannel } ', install channel = '${
443
- testParams . installChannel
444
- } ', ${
356
+ } ', install channel = '${ testParams . installChannel } ', ${
445
357
! testParams . hasUserBeenNotified
446
358
? 'user has not been notified to install insiders'
447
359
: 'user has already been notified to install insiders'
448
360
} , isChannelUsingDefaultConfiguration = ${ testParams . isChannelUsingDefaultConfiguration } `;
449
361
test ( testName , async ( ) => {
450
- setState ( testParams , false , false ) ;
362
+ setState ( testParams , false ) ;
451
363
452
364
await insidersExtensionService . handleEdgeCases (
453
- testParams . installChannel ,
454
365
testParams . isChannelUsingDefaultConfiguration || testParams . installChannel === 'off'
455
366
) ;
456
367
0 commit comments