@@ -12,9 +12,19 @@ import parse from 'json-to-ast';
12
12
import { createCodeLensForPluginNodes } from '../codelens' ;
13
13
import { handleStartNotification } from '../notifications' ;
14
14
import { handleStatusBarUpdate , statusBarLoop } from '../statusbar' ;
15
- import { testDevProxyInstall } from '../constants' ;
16
15
import * as sinon from 'sinon' ;
17
16
import * as detect from '../detect' ;
17
+ import { DevProxyInstall } from '../types' ;
18
+
19
+ export const testDevProxyInstall : DevProxyInstall = {
20
+ isBeta : false ,
21
+ isInstalled : true ,
22
+ isOutdated : true ,
23
+ isRunning : false ,
24
+ outdatedVersion : '0.14.1' ,
25
+ platform : 'win32' ,
26
+ version : '0.14.1' ,
27
+ } ;
18
28
19
29
suite ( 'extension' , ( ) => {
20
30
@@ -300,14 +310,14 @@ suite('notifications', () => {
300
310
test ( 'should show install notification when devproxy is not installed on mac' , async ( ) => {
301
311
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
302
312
await context . globalState . update ( 'devProxyInstall' , {
303
- filePath : '' ,
304
- version : '' ,
305
- platform : 'darwin' ,
306
- isInstalled : false ,
307
- latestVersion : '0.14.1' ,
308
313
isBeta : false ,
309
- isLatest : false
310
- } ) ;
314
+ isInstalled : false ,
315
+ isOutdated : false ,
316
+ isRunning : false ,
317
+ platform : 'darwin' ,
318
+ outdatedVersion : '0.14.1' ,
319
+ version : '' ,
320
+ } as DevProxyInstall ) ;
311
321
312
322
const notification = handleStartNotification ( context ) ;
313
323
@@ -395,14 +405,14 @@ suite('notifications', () => {
395
405
test ( 'should show upgrade notification when devproxy is not latest version' , async ( ) => {
396
406
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
397
407
await context . globalState . update ( 'devProxyInstall' , {
398
- filePath : 'somepath/devproxy' ,
399
- version : '0.1.0' ,
400
- platform : 'win32' ,
401
- isInstalled : true ,
402
- latestVersion : '0.14.1' ,
403
408
isBeta : false ,
404
- isLatest : false
405
- } ) ;
409
+ isInstalled : true ,
410
+ isOutdated : true ,
411
+ isRunning : false ,
412
+ platform : 'win32' ,
413
+ outdatedVersion : '0.14.1' ,
414
+ version : '0.1.0' ,
415
+ } as DevProxyInstall ) ;
406
416
407
417
const notification = handleStartNotification ( context ) ;
408
418
@@ -427,14 +437,14 @@ suite('statusbar', () => {
427
437
test ( 'should show error statusbar when devproxy is not installed' , async ( ) => {
428
438
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
429
439
await context . globalState . update ( 'devProxyInstall' , {
430
- filePath : '' ,
431
- version : '' ,
432
- platform : 'darwin' ,
433
- isInstalled : false ,
434
- latestVersion : '0.14.1' ,
435
440
isBeta : false ,
436
- isLatest : false
437
- } ) ;
441
+ isInstalled : false ,
442
+ isOutdated : false ,
443
+ isRunning : false ,
444
+ platform : 'win32' ,
445
+ outdatedVersion : '0.14.1' ,
446
+ version : '0.1.0' ,
447
+ } as DevProxyInstall ) ;
438
448
const statusBar = vscode . window . createStatusBarItem (
439
449
vscode . StatusBarAlignment . Right ,
440
450
100
@@ -449,14 +459,14 @@ suite('statusbar', () => {
449
459
test ( 'should show warning statusbar when devproxy is not latest version' , async ( ) => {
450
460
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
451
461
await context . globalState . update ( 'devProxyInstall' , {
452
- filePath : 'somepath/devproxy' ,
453
- version : '0.1.0' ,
454
- platform : 'win32' ,
455
- isInstalled : true ,
456
- latestVersion : '0.14.1' ,
457
462
isBeta : false ,
458
- isLatest : false
459
- } ) ;
463
+ isInstalled : true ,
464
+ isOutdated : true ,
465
+ isRunning : false ,
466
+ platform : 'win32' ,
467
+ outdatedVersion : '0.14.1' ,
468
+ version : '0.1.0' ,
469
+ } as DevProxyInstall ) ;
460
470
const statusBar = vscode . window . createStatusBarItem (
461
471
vscode . StatusBarAlignment . Right ,
462
472
100
@@ -471,14 +481,14 @@ suite('statusbar', () => {
471
481
test ( 'should show success statusbar when devproxy is installed and latest version' , async ( ) => {
472
482
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
473
483
await context . globalState . update ( 'devProxyInstall' , {
474
- filePath : 'somepath/devproxy' ,
475
- version : '0.14.1' ,
476
- platform : 'win32' ,
477
- isInstalled : true ,
478
- latestVersion : '0.14.1' ,
479
484
isBeta : false ,
480
- isLatest : true
481
- } ) ;
485
+ isInstalled : true ,
486
+ isOutdated : false ,
487
+ isRunning : false ,
488
+ platform : 'win32' ,
489
+ outdatedVersion : '' ,
490
+ version : '0.14.1' ,
491
+ } as DevProxyInstall ) ;
482
492
const statusBar = vscode . window . createStatusBarItem (
483
493
vscode . StatusBarAlignment . Right ,
484
494
100
@@ -521,14 +531,14 @@ suite('schema', () => {
521
531
test ( 'should show warning when $schema property does not match installed version' , async ( ) => {
522
532
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
523
533
await context . globalState . update ( 'devProxyInstall' , {
524
- filePath : 'somepath/devproxy' ,
525
- version : '0.1.0' ,
526
- platform : 'win32' ,
527
- isInstalled : true ,
528
- latestVersion : '0.14.1' ,
529
534
isBeta : false ,
530
- isLatest : false
531
- } ) ;
535
+ isInstalled : true ,
536
+ isOutdated : true ,
537
+ isRunning : false ,
538
+ platform : 'win32' ,
539
+ outdatedVersion : '0.14.1' ,
540
+ version : '0.1.0' ,
541
+ } as DevProxyInstall ) ;
532
542
533
543
const fileName = 'config-schema-mismatch.json' ;
534
544
const filePath = path . resolve ( __dirname , 'examples' , fileName ) ;
@@ -550,14 +560,14 @@ suite('schema', () => {
550
560
test ( 'should not show warning when $schema property matches installed version' , async ( ) => {
551
561
const context = await vscode . extensions . getExtension ( 'garrytrinder.dev-proxy-toolkit' ) ?. activate ( ) as vscode . ExtensionContext ;
552
562
await context . globalState . update ( 'devProxyInstall' , {
553
- filePath : 'somepath/devproxy' ,
554
- version : '0.14.1' ,
555
- platform : 'win32' ,
556
- isInstalled : true ,
557
- latestVersion : '0.14.1' ,
558
563
isBeta : false ,
559
- isLatest : true
560
- } ) ;
564
+ isInstalled : true ,
565
+ isOutdated : false ,
566
+ isRunning : false ,
567
+ platform : 'win32' ,
568
+ outdatedVersion : '' ,
569
+ version : '0.14.1' ,
570
+ } as DevProxyInstall ) ;
561
571
562
572
const fileName = 'config-schema-version.json' ;
563
573
const filePath = path . resolve ( __dirname , 'examples' , fileName ) ;
0 commit comments