tests: cleanup filemanager test

Remove dead code.
This commit is contained in:
Benoit Pierre
2024-12-25 15:46:04 +01:00
committed by Frans de Jonge
parent e0562f72e5
commit d568b8fbbc

View File

@@ -30,11 +30,14 @@ describe("FileManager module", function()
}
local old_show = UIManager.show
local tmp_fn = "/abc/123/test/foo.bar.baz.tmp.epub.pdf"
local show_called = false
UIManager.show = function(self, w)
assert.Equals(w.text, "File not found:\n"..tmp_fn)
show_called = true
end
assert.is_nil(lfs.attributes(tmp_fn))
filemanager:showDeleteFileDialog(tmp_fn)
assert.is_truthy(show_called)
UIManager.show = old_show
filemanager:onClose()
end)
@@ -55,7 +58,6 @@ describe("FileManager module", function()
tmpsf:write("{}")
tmpsf:close()
util.copyFile(tmp_sidecar_file, tmp_sidecar_file_foo)
local old_show = UIManager.show
-- make sure file exists
assert.is_not_nil(lfs.attributes(tmp_fn))
@@ -63,11 +65,7 @@ describe("FileManager module", function()
assert.is_not_nil(lfs.attributes(tmp_sidecar_file))
assert.is_not_nil(lfs.attributes(tmp_sidecar_file_foo))
UIManager.show = function(self, w)
assert.Equals(w.text, "Deleted file:\n"..tmp_fn)
end
filemanager:deleteFile(tmp_fn, true)
UIManager.show = old_show
filemanager:onClose()
-- make sure sdr folder exists
@@ -96,18 +94,13 @@ describe("FileManager module", function()
local tmpfp = io.open(tmp_history, "w")
tmpfp:write("{}")
tmpfp:close()
local old_show = UIManager.show
-- make sure file exists
assert.is_not_nil(lfs.attributes(tmp_fn))
assert.is_not_nil(lfs.attributes(tmp_sidecar))
assert.is_not_nil(lfs.attributes(tmp_history))
UIManager.show = function(self, w)
assert.Equals(w.text, "Deleted file:\n"..tmp_fn)
end
filemanager:deleteFile(tmp_fn, true)
UIManager.show = old_show
filemanager:onClose()
assert.is_nil(lfs.attributes(tmp_fn))