@@ -121,6 +121,7 @@ describe("adm-zip.js - methods handling local files", () => {
121121 } ) ;
122122
123123 describe ( ".extractEntryTo() - sync" , ( ) => {
124+ // each entry one by one
124125 it ( "zip.extractEntryTo(entry, destination, false, true)" , ( ) => {
125126 const zip = new Zip ( "./test/assets/ultra.zip" ) ;
126127 var zipEntries = zip . getEntries ( ) ;
@@ -132,6 +133,7 @@ describe("adm-zip.js - methods handling local files", () => {
132133 expect ( files . sort ( ) ) . to . deep . equal ( ultrazip . sort ( ) ) ;
133134 } ) ;
134135
136+ // each entry one by one
135137 it ( "zip.extractEntryTo(entry, destination, true, true)" , ( ) => {
136138 const zip = new Zip ( "./test/assets/ultra.zip" ) ;
137139 var zipEntries = zip . getEntries ( ) ;
@@ -149,6 +151,58 @@ describe("adm-zip.js - methods handling local files", () => {
149151
150152 expect ( files . sort ( ) ) . to . deep . equal ( ultrazip . sort ( ) ) ;
151153 } ) ;
154+
155+ it ( "zip.extractEntryTo(entry, destination, false, true) - [ extract folder from file where folders exists ]" , ( ) => {
156+ const zip = new Zip ( "./test/assets/maximum.zip" ) ;
157+
158+ zip . extractEntryTo ( "./attributes_test/New folder/" , destination , false , true ) ;
159+
160+ const files = walk ( destination ) ;
161+ const maximumzip = [ "hidden.txt" , "hidden_readonly.txt" , "readonly.txt" , "somefile.txt" ] . map ( wrapList ) ;
162+
163+ expect ( files . sort ( ) ) . to . deep . equal ( maximumzip . sort ( ) ) ;
164+ } ) ;
165+
166+ it ( "zip.extractEntryTo(entry, destination, false, true) - [ extract folder from file where folders does not exists ]" , ( ) => {
167+ const zip = new Zip ( "./test/assets/maximum3.zip" ) ;
168+
169+ zip . extractEntryTo ( "./attributes_test/New folder/" , destination , false , true ) ;
170+
171+ const files = walk ( destination ) ;
172+ const maximumzip = [ "hidden.txt" , "hidden_readonly.txt" , "readonly.txt" , "somefile.txt" ] . map ( wrapList ) ;
173+
174+ expect ( files . sort ( ) ) . to . deep . equal ( maximumzip . sort ( ) ) ;
175+ } ) ;
176+
177+ it ( "zip.extractEntryTo(entry, destination, true, true) - [ extract folder from file where folders exists ]" , ( ) => {
178+ const zip = new Zip ( "./test/assets/maximum.zip" ) ;
179+
180+ zip . extractEntryTo ( "./attributes_test/New folder/" , destination , true , true ) ;
181+
182+ const files = walk ( destination ) ;
183+ const maximumzip = [
184+ "./attributes_test/New folder/hidden.txt" ,
185+ "./attributes_test/New folder/hidden_readonly.txt" ,
186+ "./attributes_test/New folder/readonly.txt" ,
187+ "./attributes_test/New folder/somefile.txt"
188+ ] . map ( wrapList ) ;
189+ expect ( files . sort ( ) ) . to . deep . equal ( maximumzip . sort ( ) ) ;
190+ } ) ;
191+
192+ it ( "zip.extractEntryTo(entry, destination, true, true) - [ extract folder from file where folders does not exists ]" , ( ) => {
193+ const zip = new Zip ( "./test/assets/maximum3.zip" ) ;
194+
195+ zip . extractEntryTo ( "./attributes_test/New folder/" , destination , true , true ) ;
196+
197+ const files = walk ( destination ) ;
198+ const maximumzip = [
199+ "./attributes_test/New folder/hidden.txt" ,
200+ "./attributes_test/New folder/hidden_readonly.txt" ,
201+ "./attributes_test/New folder/readonly.txt" ,
202+ "./attributes_test/New folder/somefile.txt"
203+ ] . map ( wrapList ) ;
204+ expect ( files . sort ( ) ) . to . deep . equal ( maximumzip . sort ( ) ) ;
205+ } ) ;
152206 } ) ;
153207
154208 describe ( ".addLocalFolder() - sync" , ( ) => {
0 commit comments