@@ -121,6 +121,7 @@ describe("adm-zip.js - methods handling local files", () => {
121
121
} ) ;
122
122
123
123
describe ( ".extractEntryTo() - sync" , ( ) => {
124
+ // each entry one by one
124
125
it ( "zip.extractEntryTo(entry, destination, false, true)" , ( ) => {
125
126
const zip = new Zip ( "./test/assets/ultra.zip" ) ;
126
127
var zipEntries = zip . getEntries ( ) ;
@@ -132,6 +133,7 @@ describe("adm-zip.js - methods handling local files", () => {
132
133
expect ( files . sort ( ) ) . to . deep . equal ( ultrazip . sort ( ) ) ;
133
134
} ) ;
134
135
136
+ // each entry one by one
135
137
it ( "zip.extractEntryTo(entry, destination, true, true)" , ( ) => {
136
138
const zip = new Zip ( "./test/assets/ultra.zip" ) ;
137
139
var zipEntries = zip . getEntries ( ) ;
@@ -149,6 +151,58 @@ describe("adm-zip.js - methods handling local files", () => {
149
151
150
152
expect ( files . sort ( ) ) . to . deep . equal ( ultrazip . sort ( ) ) ;
151
153
} ) ;
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
+ } ) ;
152
206
} ) ;
153
207
154
208
describe ( ".addLocalFolder() - sync" , ( ) => {
0 commit comments