@@ -14,7 +14,7 @@ import {
14
14
splitOnFirstEquals ,
15
15
} from "../../../src/node/cli"
16
16
import { tmpdir } from "../../../src/node/constants"
17
- import { paths } from "../../../src/node/util"
17
+ import { generatePassword , paths } from "../../../src/node/util"
18
18
import { useEnv } from "../../utils/helpers"
19
19
20
20
type Mutable < T > = {
@@ -645,16 +645,13 @@ describe("bindAddrFromArgs", () => {
645
645
} )
646
646
647
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
- } )
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` )
659
656
} )
660
657
} )
0 commit comments