Skip to content

Commit 77c1150

Browse files
committed
feat(cli): add test for defaultConfigFile
1 parent fb2625d commit 77c1150

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/unit/node/cli.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as path from "path"
66
import {
77
Args,
88
bindAddrFromArgs,
9+
defaultConfigFile,
910
parse,
1011
setDefaults,
1112
shouldOpenInExistingInstance,
@@ -642,3 +643,18 @@ describe("bindAddrFromArgs", () => {
642643
resetValue()
643644
})
644645
})
646+
647+
describe("defaultConfigFile", () => {
648+
it("should return the dfeault config file as a string", async () => {
649+
const actualDefaultConfigFile = await defaultConfigFile()
650+
// Since the password is autogenerated within the function
651+
// we can't assert it with .toMatch
652+
// but we can check that the config at least includes
653+
// these strings.
654+
const expectedStrings = [`bind-addr: 127.0.0.1:8080`, `auth: password`, `password`, `cert: false`]
655+
656+
expectedStrings.forEach((str) => {
657+
expect(actualDefaultConfigFile).toContain(str)
658+
})
659+
})
660+
})

0 commit comments

Comments
 (0)