Archived
1
0

feat(cli): add test for defaultConfigFile

This commit is contained in:
Joe Previte 2021-09-28 15:45:44 -07:00
parent fb2625dbe8
commit 77c1150b8d
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -6,6 +6,7 @@ import * as path from "path"
import { import {
Args, Args,
bindAddrFromArgs, bindAddrFromArgs,
defaultConfigFile,
parse, parse,
setDefaults, setDefaults,
shouldOpenInExistingInstance, shouldOpenInExistingInstance,
@ -642,3 +643,18 @@ describe("bindAddrFromArgs", () => {
resetValue() resetValue()
}) })
}) })
describe("defaultConfigFile", () => {
it("should return the dfeault config file as a string", async () => {
const actualDefaultConfigFile = await defaultConfigFile()
// Since the password is autogenerated within the function
// we can't assert it with .toMatch
// but we can check that the config at least includes
// these strings.
const expectedStrings = [`bind-addr: 127.0.0.1:8080`, `auth: password`, `password`, `cert: false`]
expectedStrings.forEach((str) => {
expect(actualDefaultConfigFile).toContain(str)
})
})
})