Skip to content

Commit e9cc8ed

Browse files
committed
test: normalise file paths to use the current OS's path separator.
1 parent 7b7a149 commit e9cc8ed

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

internal/config/config_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,19 @@ system:
288288
require.Len(t, rootCfg.Resources, 1)
289289
require.Equal(t, "/test", rootCfg.Resources[0].Path)
290290

291-
// Check sub-directory config paths
291+
// Check subdirectory config paths
292292
require.Len(t, subCfg.Resources, 2)
293293
require.Equal(t, "/api/v1/users", subCfg.Resources[0].Path)
294-
require.Equal(t, "api/v1/users-response.json", subCfg.Resources[0].Response.File)
295-
require.Equal(t, "api/v1/static-content", subCfg.Resources[1].Response.Dir)
294+
require.Equal(t, normalisePathToCurrentOs("api/v1/users-response.json"), subCfg.Resources[0].Response.File)
295+
require.Equal(t, normalisePathToCurrentOs("api/v1/static-content"), subCfg.Resources[1].Response.Dir)
296296

297297
// Check system store preload file path
298-
require.Equal(t, "api/v1/user-db.json", subCfg.System.Stores["users"].PreloadFile)
298+
require.Equal(t, normalisePathToCurrentOs("api/v1/user-db.json"), subCfg.System.Stores["users"].PreloadFile)
299+
}
300+
301+
// normalisePathToCurrentOs normalises the file path to use the current OS's path separator.
302+
func normalisePathToCurrentOs(path string) string {
303+
return filepath.FromSlash(path)
299304
}
300305

301306
func TestLoadConfig_WithInterceptors(t *testing.T) {

0 commit comments

Comments
 (0)