From 0ba2409c9a07d52d5811323145faacf34249188e Mon Sep 17 00:00:00 2001 From: Leeingnyo Date: Tue, 26 Jan 2021 04:18:09 +0900 Subject: [PATCH] add tests about is_interesting_file --- spec/util_spec.cr | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/util_spec.cr b/spec/util_spec.cr index 94c326c..5401eb1 100644 --- a/spec/util_spec.cr +++ b/spec/util_spec.cr @@ -35,6 +35,26 @@ describe "compare_numerically" do end end +describe "is_interesting_file" do + it "returns true when filename has interesting file extension" do + filename = "manga.cbz" + result = is_interesting_file filename + result.should eq true + end + + it "returns false if file extension is not interesting" do + filename = "info.json" + result = is_interesting_file filename + result.should eq false + end + + it "returns true when fileext has uppercase" do + filename = "manga.ZiP" + result = is_interesting_file filename + result.should eq true + end +end + describe "chapter_sort" do it "sorts correctly" do ary = ["Vol.1 Ch.01", "Vol.1 Ch.02", "Vol.2 Ch. 2.5", "Ch. 3", "Ch.04"]