added unit test for this

This commit is contained in:
Shreyas Goenka 2023-06-16 00:54:00 +02:00
parent 0947b61bab
commit 95f37b1d96
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package filer
import (
"context"
"path/filepath"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLocalClientAtRootForWindows(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("this test is only meant for windows")
}
tmpDir := t.TempDir()
ctx := context.Background()
// create filer root at "root"
f, err := NewLocalClient("/")
require.NoError(t, err)
// Assert stat call to the temp dir succeeds.
info, err := f.Stat(ctx, tmpDir)
assert.NoError(t, err)
assert.Equal(t, filepath.Base(tmpDir), info.Name())
assert.True(t, info.IsDir())
}