From ed3f8f58fba97be3e88bb3d1dc5d1ee006d64aa9 Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Sun, 17 Nov 2024 16:18:33 -0500 Subject: [PATCH] improve unit tests --- lib/extraction/extractors_test.go | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/extraction/extractors_test.go b/lib/extraction/extractors_test.go index afc72ed..8f6478e 100644 --- a/lib/extraction/extractors_test.go +++ b/lib/extraction/extractors_test.go @@ -65,6 +65,46 @@ var _ = Describe("Extractor", func() { defer ef.Extract(ef.Name) }) + + It("should select the correct extractor for .tar.bz2 files", func() { + extractor := extraction.NewExtractor(testFS, "test.tar.bz2", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.ArchiveExtractor{})) + }) + + It("should select the correct extractor for .tar.xz files", func() { + extractor := extraction.NewExtractor(testFS, "test.tar.xz", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.ArchiveExtractor{})) + }) + + It("should select the correct extractor for .tar.zst files", func() { + extractor := extraction.NewExtractor(testFS, "test.tar.zst", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.ArchiveExtractor{})) + }) + + It("should select the correct extractor for .tar files", func() { + extractor := extraction.NewExtractor(testFS, "test.tar", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.ArchiveExtractor{})) + }) + + It("should select the correct extractor for .zip files", func() { + extractor := extraction.NewExtractor(testFS, "test.zip", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.ArchiveExtractor{})) + }) + + It("should select the correct extractor for .bz2 files", func() { + extractor := extraction.NewExtractor(testFS, "test.bz2", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.SingleFileExtractor{})) + }) + + It("should select the correct extractor for .xz files", func() { + extractor := extraction.NewExtractor(testFS, "test.xz", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.SingleFileExtractor{})) + }) + + It("should select the correct extractor for .zst files", func() { + extractor := extraction.NewExtractor(testFS, "test.zst", "", nil) + Expect(extractor).To(BeAssignableToTypeOf(&extraction.SingleFileExtractor{})) + }) }) })