MCPcopy Index your code
hub / github.com/livekit/livekit / TestGetConfigString

Function TestGetConfigString

cmd/server/main_test.go:32–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestGetConfigString(t *testing.T) {
33 tests := []testStruct{
34 {"", "", nil, ""},
35 {"", "configBody", nil, "configBody"},
36 {"file", "configBody", nil, "configBody"},
37 {"file", "", nil, "fileContent"},
38 }
39 for _, test := range tests {
40 func() {
41 writeConfigFile(test, t)
42 defer os.Remove(test.configFileName)
43
44 configBody, err := getConfigString(test.configFileName, test.configBody)
45 require.Equal(t, test.expectedError, err)
46 require.Equal(t, test.expectedConfigBody, configBody)
47 }()
48 }
49}
50
51func TestShouldReturnErrorIfConfigFileDoesNotExist(t *testing.T) {
52 configBody, err := getConfigString("notExistingFile", "")

Callers

nothing calls this directly

Calls 2

writeConfigFileFunction · 0.85
getConfigStringFunction · 0.85

Tested by

no test coverage detected