@@ -14,7 +14,7 @@ import {
1414 splitOnFirstEquals ,
1515} from "../../../src/node/cli"
1616import { tmpdir } from "../../../src/node/constants"
17- import { paths } from "../../../src/node/util"
17+ import { generatePassword , paths } from "../../../src/node/util"
1818import { useEnv } from "../../utils/helpers"
1919
2020type Mutable < T > = {
@@ -645,16 +645,13 @@ describe("bindAddrFromArgs", () => {
645645} )
646646
647647describe ( "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- } )
648+ it ( "should return the default config file as a string" , async ( ) => {
649+ const password = await generatePassword ( )
650+ const actual = defaultConfigFile ( password )
651+
652+ expect ( actual ) . toMatch ( `bind-addr: 127.0.0.1:8080
653+ auth: password
654+ password: ${ password }
655+ cert: false` )
659656 } )
660657} )
0 commit comments