@@ -7,13 +7,13 @@ const testMe = require('../utils');
7
7
const sinon = require ( 'sinon' ) ;
8
8
9
9
describe ( 'utils' , ( ) => {
10
-
11
10
describe ( 'adjustArchiveStructure' , ( ) => {
12
-
13
11
let consoleStub ;
14
12
15
13
beforeEach ( ( ) => {
16
- consoleStub = sinon . stub ( console , 'log' ) . value ( ( ) => { } ) ;
14
+ consoleStub = sinon . stub ( console , 'log' ) . value ( ( ) => {
15
+ /* NOOP */
16
+ } ) ;
17
17
} ) ;
18
18
19
19
afterEach ( ( ) => {
@@ -34,8 +34,15 @@ describe('utils', () => {
34
34
35
35
it ( 'should reject when target directory does not exist' , async ( ) => {
36
36
try {
37
- const zip = path . join ( __dirname , 'resources' , 'zip-with-base-folder.zip' ) ;
38
- await testMe . adjustArchiveStructure ( zip , path . join ( __dirname , 'some' , 'missing' , 'path' ) ) ;
37
+ const zip = path . join (
38
+ __dirname ,
39
+ 'resources' ,
40
+ 'zip-with-base-folder.zip'
41
+ ) ;
42
+ await testMe . adjustArchiveStructure (
43
+ zip ,
44
+ path . join ( __dirname , 'some' , 'missing' , 'path' )
45
+ ) ;
39
46
throw new Error ( 'Expected a rejection' ) ;
40
47
} catch ( e ) {
41
48
expect ( e ) . to . be . an . instanceOf ( Error ) ;
@@ -45,7 +52,11 @@ describe('utils', () => {
45
52
46
53
it ( 'should reject when target is a file' , async ( ) => {
47
54
try {
48
- const zip = path . join ( __dirname , 'resources' , 'zip-with-base-folder.zip' ) ;
55
+ const zip = path . join (
56
+ __dirname ,
57
+ 'resources' ,
58
+ 'zip-with-base-folder.zip'
59
+ ) ;
49
60
await testMe . adjustArchiveStructure ( zip , path . join ( __filename ) ) ;
50
61
throw new Error ( 'Expected a rejection' ) ;
51
62
} catch ( e ) {
@@ -56,7 +67,10 @@ describe('utils', () => {
56
67
57
68
it ( 'should be a NOOP when the zip already has the desired base folder' , async ( ) => {
58
69
const zip = path . join ( __dirname , 'resources' , 'zip-with-base-folder.zip' ) ;
59
- const actual = await testMe . adjustArchiveStructure ( zip , track . mkdirSync ( ) ) ;
70
+ const actual = await testMe . adjustArchiveStructure (
71
+ zip ,
72
+ track . mkdirSync ( )
73
+ ) ;
60
74
expect ( actual ) . to . be . equal ( zip ) ;
61
75
} ) ;
62
76
@@ -92,7 +106,13 @@ describe('utils', () => {
92
106
93
107
const verifyOut = track . mkdirSync ( ) ;
94
108
await unpack ( actual , verifyOut ) ;
95
- expect ( fs . lstatSync ( path . join ( verifyOut , 'zip-with-symlink' , 'folder' , 'symlinked-sub' ) ) . isSymbolicLink ( ) ) . to . be . true ;
109
+ expect (
110
+ fs
111
+ . lstatSync (
112
+ path . join ( verifyOut , 'zip-with-symlink' , 'folder' , 'symlinked-sub' )
113
+ )
114
+ . isSymbolicLink ( )
115
+ ) . to . be . true ;
96
116
} ) ;
97
117
98
118
it ( 'should adjust the archive structure if base folder is not present' , async ( ) => {
@@ -113,7 +133,5 @@ describe('utils', () => {
113
133
expect ( subs ) . to . have . lengthOf ( 3 ) ;
114
134
expect ( subs . sort ( ) ) . to . be . deep . equal ( [ 'a.txt' , 'b.txt' , 'foo' ] ) ;
115
135
} ) ;
116
-
117
136
} ) ;
118
-
119
- } ) ;
137
+ } ) ;
0 commit comments