diff --git a/pkg/aiusechat/tools_readdir_test.go b/pkg/aiusechat/tools_readdir_test.go index 7560a73a4d..7d91f7dfca 100644 --- a/pkg/aiusechat/tools_readdir_test.go +++ b/pkg/aiusechat/tools_readdir_test.go @@ -11,6 +11,7 @@ import ( "testing" "github.com/wavetermdev/waveterm/pkg/aiusechat/uctypes" + "github.com/wavetermdev/waveterm/pkg/util/fileutil" ) func TestReadDirCallback(t *testing.T) { @@ -64,16 +65,16 @@ func TestReadDirCallback(t *testing.T) { t.Errorf("Expected 3 entries, got %d", entryCount) } - entries, ok := resultMap["entries"].([]map[string]any) + entries, ok := resultMap["entries"].([]fileutil.DirEntryOut) if !ok { - t.Fatalf("entries is not a slice of maps") + t.Fatalf("entries is not a slice of DirEntryOut") } // Check that we have the expected entries foundFiles := 0 foundDirs := 0 for _, entry := range entries { - if entry["is_dir"].(bool) { + if entry.Dir { foundDirs++ } else { foundFiles++ @@ -208,12 +209,15 @@ func TestReadDirSortBeforeTruncate(t *testing.T) { } resultMap := result.(map[string]any) - entries := resultMap["entries"].([]map[string]any) + entries, ok := resultMap["entries"].([]fileutil.DirEntryOut) + if !ok { + t.Fatalf("entries is not a slice of DirEntryOut") + } // Count directories in the result dirCount := 0 for _, entry := range entries { - if entry["is_dir"].(bool) { + if entry.Dir { dirCount++ } } @@ -225,7 +229,7 @@ func TestReadDirSortBeforeTruncate(t *testing.T) { // First 3 entries should be directories for i := 0; i < 3; i++ { - if !entries[i]["is_dir"].(bool) { + if !entries[i].Dir { t.Errorf("Expected entry %d to be a directory, but it was a file", i) } }