From 77c1150b8dbd2c71300c84fda827240aa494fba7 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 28 Sep 2021 15:45:44 -0700 Subject: [PATCH] feat(cli): add test for defaultConfigFile --- test/unit/node/cli.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/unit/node/cli.test.ts b/test/unit/node/cli.test.ts index e92cb9758..9bf9fbe67 100644 --- a/test/unit/node/cli.test.ts +++ b/test/unit/node/cli.test.ts @@ -6,6 +6,7 @@ import * as path from "path" import { Args, bindAddrFromArgs, + defaultConfigFile, parse, setDefaults, shouldOpenInExistingInstance, @@ -642,3 +643,18 @@ describe("bindAddrFromArgs", () => { 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) + }) + }) +})