Skip to content

Commit f2b0b8e

Browse files
committed
fix: Fix test duplication, and added test for empty panel
1 parent 3f5cdf7 commit f2b0b8e

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/internal/handle_file_operation_test.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,6 @@ func TestCompressSelectedFiles(t *testing.T) {
9191
extractedDirName: "file1",
9292
expectedFilesAfterExtract: []string{"file1.txt"},
9393
},
94-
{
95-
name: "Single File Compress with select mode with different cursor and selection",
96-
startDir: curTestDir,
97-
cursor: 0, // points to dir1
98-
selectMode: true,
99-
selectedElem: []string{file1},
100-
expectedZipName: "file1.zip",
101-
cursorIndexForZip: 3,
102-
extractedDirName: "file1",
103-
expectedFilesAfterExtract: []string{"file1.txt"},
104-
},
10594
{
10695
name: "Multi file compression",
10796
startDir: curTestDir,
@@ -166,4 +155,13 @@ func TestCompressSelectedFiles(t *testing.T) {
166155
require.NoError(t, os.RemoveAll(zipFile))
167156
})
168157
}
158+
159+
t.Run("Compress on Empty panel", func(t *testing.T) {
160+
m := defaultTestModel(dir2)
161+
TeaUpdateWithErrCheck(t, &m, utils.TeaRuneKeyMsg(common.Hotkeys.CompressFile[0]))
162+
// Should not crash. Nothing should happen. If there is a crash, it will be caught
163+
entries, err := os.ReadDir(dir2)
164+
require.NoError(t, err)
165+
assert.Empty(t, entries)
166+
})
169167
}

0 commit comments

Comments
 (0)