(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func 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 | |
| 51 | func TestShouldReturnErrorIfConfigFileDoesNotExist(t *testing.T) { |
| 52 | configBody, err := getConfigString("notExistingFile", "") |
nothing calls this directly
no test coverage detected