@@ -3,7 +3,14 @@ import { promises as fs } from "fs"
33import * as net from "net"
44import * as os from "os"
55import * as path from "path"
6- import { Args , parse , setDefaults , shouldOpenInExistingInstance , splitOnFirstEquals } from "../../../src/node/cli"
6+ import {
7+ Args ,
8+ parse ,
9+ setDefaults ,
10+ shouldOpenInExistingInstance ,
11+ shouldRunVsCodeCli ,
12+ splitOnFirstEquals ,
13+ } from "../../../src/node/cli"
714import { tmpdir } from "../../../src/node/constants"
815import { paths } from "../../../src/node/util"
916
@@ -463,3 +470,48 @@ describe("splitOnFirstEquals", () => {
463470 expect ( actual ) . toEqual ( expect . arrayContaining ( expected ) )
464471 } )
465472} )
473+
474+ describe ( "shouldRunVsCodeCli" , ( ) => {
475+ it ( "should return false if no 'extension' related args passed in" , ( ) => {
476+ const args = {
477+ _ : [ ] ,
478+ }
479+ const actual = shouldRunVsCodeCli ( args )
480+ const expected = false
481+
482+ expect ( actual ) . toBe ( expected )
483+ } )
484+
485+ it ( "should return true if 'list-extensions' passed in" , ( ) => {
486+ const args = {
487+ _ : [ ] ,
488+ [ "list-extensions" ] : true ,
489+ }
490+ const actual = shouldRunVsCodeCli ( args )
491+ const expected = true
492+
493+ expect ( actual ) . toBe ( expected )
494+ } )
495+
496+ it ( "should return true if 'install-extension' passed in" , ( ) => {
497+ const args = {
498+ _ : [ ] ,
499+ [ "install-extension" ] : [ "hello.world" ] ,
500+ }
501+ const actual = shouldRunVsCodeCli ( args )
502+ const expected = true
503+
504+ expect ( actual ) . toBe ( expected )
505+ } )
506+
507+ it ( "should return true if 'uninstall-extension' passed in" , ( ) => {
508+ const args = {
509+ _ : [ ] ,
510+ [ "uninstall-extension" ] : [ "hello.world" ] ,
511+ }
512+ const actual = shouldRunVsCodeCli ( args )
513+ const expected = true
514+
515+ expect ( actual ) . toBe ( expected )
516+ } )
517+ } )
0 commit comments