From d568b8fbbca2d39bab71f29d800b6fb53e01da26 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Wed, 25 Dec 2024 15:46:04 +0100 Subject: [PATCH] tests: cleanup filemanager test Remove dead code. --- spec/unit/filemanager_spec.lua | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/spec/unit/filemanager_spec.lua b/spec/unit/filemanager_spec.lua index 7fadca659..e12ba8b1c 100644 --- a/spec/unit/filemanager_spec.lua +++ b/spec/unit/filemanager_spec.lua @@ -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))