@@ -12,6 +12,7 @@ import parse from 'json-to-ast';
12
12
import { createCodeLensForPluginNodes } from '../codelens' ;
13
13
import { DevProxyInstall } from '../types' ;
14
14
import { handleStartNotification } from '../notifications' ;
15
+ import { handleStatusBarUpdate } from '../statusbar' ;
15
16
16
17
suite ( 'urlsToWatch' , ( ) => {
17
18
test ( 'should show error when opening document with no urlsToWatch found' , async ( ) => {
@@ -335,4 +336,69 @@ suite('notifications', () => {
335
336
const actual = notification !== undefined && notification ( ) . message ;
336
337
assert . strictEqual ( actual , expected ) ;
337
338
} ) ;
339
+ } ) ;
340
+
341
+ suite ( 'statusbar' , ( ) => {
342
+ test ( 'should show error statusbar when devproxy is not installed' , async ( ) => {
343
+ const devProxyInstall : DevProxyInstall = {
344
+ filePath : '' ,
345
+ version : '' ,
346
+ platform : 'darwin' ,
347
+ isInstalled : false ,
348
+ latestVersion : '0.14.1' ,
349
+ isBeta : false ,
350
+ isLatest : false
351
+ } ;
352
+ const statusBar = vscode . window . createStatusBarItem (
353
+ vscode . StatusBarAlignment . Right ,
354
+ 100
355
+ ) ;
356
+ const updatedStatusBar = handleStatusBarUpdate ( statusBar , devProxyInstall ) ;
357
+
358
+ const expected = '$(error) Dev Proxy' ;
359
+ const actual = updatedStatusBar . text ;
360
+ assert . strictEqual ( actual , expected ) ;
361
+ } ) ;
362
+
363
+ test ( 'should show warning statusbar when devproxy is not latest version' , async ( ) => {
364
+ const devProxyInstall : DevProxyInstall = {
365
+ filePath : 'somepath/devproxy' ,
366
+ version : '0.1.0' ,
367
+ platform : 'win32' ,
368
+ isInstalled : true ,
369
+ latestVersion : '0.14.1' ,
370
+ isBeta : false ,
371
+ isLatest : false
372
+ } ;
373
+ const statusBar = vscode . window . createStatusBarItem (
374
+ vscode . StatusBarAlignment . Right ,
375
+ 100
376
+ ) ;
377
+ const updatedStatusBar = handleStatusBarUpdate ( statusBar , devProxyInstall ) ;
378
+
379
+ const expected = '$(warning) Dev Proxy 0.1.0' ;
380
+ const actual = updatedStatusBar . text ;
381
+ assert . strictEqual ( actual , expected ) ;
382
+ } ) ;
383
+
384
+ test ( 'should show success statusbar when devproxy is installed and latest version' , async ( ) => {
385
+ const devProxyInstall : DevProxyInstall = {
386
+ filePath : 'somepath/devproxy' ,
387
+ version : '0.14.1' ,
388
+ platform : 'win32' ,
389
+ isInstalled : true ,
390
+ latestVersion : '0.14.1' ,
391
+ isBeta : false ,
392
+ isLatest : true
393
+ } ;
394
+ const statusBar = vscode . window . createStatusBarItem (
395
+ vscode . StatusBarAlignment . Right ,
396
+ 100
397
+ ) ;
398
+ const updatedStatusBar = handleStatusBarUpdate ( statusBar , devProxyInstall ) ;
399
+
400
+ const expected = '$(check) Dev Proxy 0.14.1' ;
401
+ const actual = updatedStatusBar . text ;
402
+ assert . strictEqual ( actual , expected ) ;
403
+ } ) ;
338
404
} ) ;
0 commit comments