Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 346d52a

Browse files
committed
be more standard for #20
1 parent ad5e3f3 commit 346d52a

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed
File renamed without changes.

test/index.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test('copy a -> copy/a', function (t) {
1616
rimraf.sync(b)
1717
tar.pack(a)
1818
.pipe(tar.extract(b))
19-
.on('finish', function() {
19+
.on('finish', function () {
2020
var files = fs.readdirSync(b)
2121
t.same(files.length, 1)
2222
t.same(files[0], 'hello.txt')
@@ -37,7 +37,7 @@ test('copy b -> copy/b', function (t) {
3737
rimraf.sync(b)
3838
tar.pack(a)
3939
.pipe(tar.extract(b))
40-
.on('finish', function() {
40+
.on('finish', function () {
4141
var files = fs.readdirSync(b)
4242
t.same(files.length, 1)
4343
t.same(files[0], 'a')
@@ -46,8 +46,8 @@ test('copy b -> copy/b', function (t) {
4646
t.same(fs.statSync(dirB).mode, fs.statSync(dirA).mode)
4747
t.same(fs.statSync(dirB).mtime.getTime(), fs.statSync(dirA).mtime.getTime())
4848
t.ok(fs.statSync(dirB).isDirectory())
49-
var fileB = path.join(dirB, 'test.js')
50-
var fileA = path.join(dirA, 'test.js')
49+
var fileB = path.join(dirB, 'test.txt')
50+
var fileA = path.join(dirA, 'test.txt')
5151
t.same(fs.readFileSync(fileB, 'utf-8'), fs.readFileSync(fileA, 'utf-8'))
5252
t.same(fs.statSync(fileB).mode, fs.statSync(fileA).mode)
5353
t.same(fs.statSync(fileB).mtime.getTime(), fs.statSync(fileA).mtime.getTime())
@@ -73,7 +73,7 @@ test('symlink', function (t) {
7373
rimraf.sync(b)
7474
tar.pack(a)
7575
.pipe(tar.extract(b))
76-
.on('finish', function() {
76+
.on('finish', function () {
7777
var files = fs.readdirSync(b).sort()
7878
t.same(files.length, 2)
7979
t.same(files[0], '.gitignore')
@@ -120,7 +120,6 @@ test('follow symlinks', function (t) {
120120
})
121121
})
122122

123-
124123
test('strip', function (t) {
125124
t.plan(2)
126125

@@ -130,11 +129,11 @@ test('strip', function (t) {
130129
rimraf.sync(b)
131130

132131
tar.pack(a)
133-
.pipe(tar.extract(b, {strip:1}))
132+
.pipe(tar.extract(b, {strip: 1}))
134133
.on('finish', function () {
135134
var files = fs.readdirSync(b).sort()
136135
t.same(files.length, 1)
137-
t.same(files[0], 'test.js')
136+
t.same(files[0], 'test.txt')
138137
})
139138
})
140139

@@ -152,11 +151,11 @@ test('strip + map', function (t) {
152151
}
153152

154153
tar.pack(a)
155-
.pipe(tar.extract(b, {strip:1, map:uppercase}))
154+
.pipe(tar.extract(b, {strip: 1, map: uppercase}))
156155
.on('finish', function () {
157156
var files = fs.readdirSync(b).sort()
158157
t.same(files.length, 1)
159-
t.same(files[0], 'TEST.JS')
158+
t.same(files[0], 'TEST.TXT')
160159
})
161160
})
162161

@@ -169,19 +168,19 @@ test('map + dir + permissions', function (t) {
169168
rimraf.sync(b)
170169

171170
var aWithMode = function (header) {
172-
if(header.name === 'a') {
173-
header.mode = 0700
171+
if (header.name === 'a') {
172+
header.mode = parseInt(700, 8)
174173
}
175174
return header
176175
}
177176

178177
tar.pack(a)
179-
.pipe(tar.extract(b, {map:aWithMode}))
178+
.pipe(tar.extract(b, {map: aWithMode}))
180179
.on('finish', function () {
181180
var files = fs.readdirSync(b).sort()
182181
var stat = fs.statSync(path.join(b, 'a'))
183182
t.same(files.length, 1)
184-
t.same(stat.mode & 0777, 0700)
183+
t.same(stat.mode & parseInt(777, 8), parseInt(700, 8))
185184
})
186185
})
187186

@@ -194,7 +193,7 @@ test('specific entries', function (t) {
194193
var entries = [ 'file1', 'sub-files/file3', 'sub-dir' ]
195194

196195
rimraf.sync(b)
197-
tar.pack(a, { entries: entries })
196+
tar.pack(a, {entries: entries})
198197
.pipe(tar.extract(b))
199198
.on('finish', function () {
200199
var files = fs.readdirSync(b)

0 commit comments

Comments
 (0)