Archived
1
0

feat: add tests for shouldRunVsCodeCli

This commit is contained in:
Joe Previte 2021-09-20 14:53:09 -07:00
parent 92d0d28dd7
commit 30ade712bf
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -3,7 +3,14 @@ import { promises as fs } from "fs"
import * as net from "net"
import * as os from "os"
import * as path from "path"
import { Args, parse, setDefaults, shouldOpenInExistingInstance, splitOnFirstEquals } from "../../../src/node/cli"
import {
Args,
parse,
setDefaults,
shouldOpenInExistingInstance,
shouldRunVsCodeCli,
splitOnFirstEquals,
} from "../../../src/node/cli"
import { tmpdir } from "../../../src/node/constants"
import { paths } from "../../../src/node/util"
@ -463,3 +470,48 @@ describe("splitOnFirstEquals", () => {
expect(actual).toEqual(expect.arrayContaining(expected))
})
})
describe("shouldRunVsCodeCli", () => {
it("should return false if no 'extension' related args passed in", () => {
const args = {
_: [],
}
const actual = shouldRunVsCodeCli(args)
const expected = false
expect(actual).toBe(expected)
})
it("should return true if 'list-extensions' passed in", () => {
const args = {
_: [],
["list-extensions"]: true,
}
const actual = shouldRunVsCodeCli(args)
const expected = true
expect(actual).toBe(expected)
})
it("should return true if 'install-extension' passed in", () => {
const args = {
_: [],
["install-extension"]: ["hello.world"],
}
const actual = shouldRunVsCodeCli(args)
const expected = true
expect(actual).toBe(expected)
})
it("should return true if 'uninstall-extension' passed in", () => {
const args = {
_: [],
["uninstall-extension"]: ["hello.world"],
}
const actual = shouldRunVsCodeCli(args)
const expected = true
expect(actual).toBe(expected)
})
})