Skip to content

Commit f1aa689

Browse files
committed
coding style: standard
1 parent 8ed0152 commit f1aa689

File tree

4 files changed

+48
-60
lines changed

4 files changed

+48
-60
lines changed

index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
exports.create = require('./lib/create');
3-
exports.encode = require('./lib/encode');
4-
exports.decode = require('./lib/decode');
5-
exports.isAlias = require('./lib/is-alias');
1+
exports.create = require('./lib/create')
2+
exports.encode = require('./lib/encode')
3+
exports.decode = require('./lib/decode')
4+
exports.isAlias = require('./lib/is-alias')

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"Joshua Warner <[email protected]>"
1111
],
1212
"devDependencies": {
13-
"fs-temp": "^0.1.0",
14-
"mocha": "^2.0.1"
13+
"fs-temp": "^0.1.2",
14+
"mocha": "^2.2.5",
15+
"standard": "^4.5.4"
1516
},
1617
"scripts": {
1718
"test": "mocha"

test/addon.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
2-
var assert = require('assert');
3-
var addon = require('../build/Release/volume.node');
1+
var assert = require('assert')
2+
var addon = require('../build/Release/volume.node')
43

54
describe('addon', function () {
65
it('should find the volume name of /', function () {
7-
8-
assert.equal(addon.getVolumeName('/'), 'Macintosh HD');
9-
10-
});
11-
});
6+
assert.equal(addon.getVolumeName('/'), 'Macintosh HD')
7+
})
8+
})

test/basics.js

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
var lib = require('../')
12

2-
var lib = require('../');
3-
4-
var fs = require('fs');
5-
var path = require('path');
6-
var temp = require('fs-temp');
7-
var assert = require('assert');
3+
var fs = require('fs')
4+
var path = require('path')
5+
var temp = require('fs-temp')
6+
var assert = require('assert')
87

98
var rawData = new Buffer(
109
"AAAAAAEqAAIAAApUZXN0IFRpdGxlAAAAAAAAAAAAAAAAAAAAAADO615USCsA" +
@@ -14,27 +13,26 @@ var rawData = new Buffer(
1413
"c3QgVGl0bGU6LmJhY2tncm91bmQ6AFRlc3RCa2cudGlmZgAPABYACgBUAGUA" +
1514
"cwB0ACAAVABpAHQAbABlABIAGS8uYmFja2dyb3VuZC9UZXN0QmtnLnRpZmYA" +
1615
"ABMAEy9Wb2x1bWVzL1Rlc3QgVGl0bGUA//8AAA==", 'base64'
17-
);
16+
)
1817

1918
describe('decode', function () {
2019
it('should parse a simple alias', function () {
20+
var info = lib.decode(rawData)
2121

22-
var info = lib.decode(rawData);
23-
24-
assert.equal(info.version, 2);
22+
assert.equal(info.version, 2)
2523

2624
assert.deepEqual(info.volume, {
2725
name: 'Test Title',
2826
created: new Date('2014-01-02T18:20:04.000Z'),
2927
signature: 'H+',
3028
type: 'other',
3129
abspath: '/Volumes/Test Title'
32-
});
30+
})
3331

3432
assert.deepEqual(info.parent, {
3533
id: 19,
3634
name: '.background'
37-
});
35+
})
3836

3937
assert.deepEqual(info.target, {
4038
type: 'file',
@@ -43,54 +41,47 @@ describe('decode', function () {
4341
created: new Date('2014-01-02T18:20:08.000Z'),
4442
path: 'Test Title:.background:',
4543
abspath: '/.background/TestBkg.tiff'
46-
});
47-
48-
});
49-
});
44+
})
45+
})
46+
})
5047

5148
describe('encode', function () {
5249
it('should encode a simple alias', function () {
50+
var info = lib.decode(rawData)
51+
var buf = lib.encode(info)
5352

54-
var info = lib.decode(rawData);
55-
var buf = lib.encode(info);
56-
57-
assert.deepEqual(rawData, buf);
58-
59-
});
60-
});
53+
assert.deepEqual(rawData, buf)
54+
})
55+
})
6156

6257
describe('create', function () {
6358
it('should create a simple alias', function () {
59+
var buf = lib.create(path.join(__dirname, 'basics.js'))
60+
var info = lib.decode(buf)
6461

65-
var buf = lib.create(path.join(__dirname, 'basics.js'));
66-
var info = lib.decode(buf);
67-
68-
assert.equal('file', info.target.type);
69-
assert.equal('basics.js', info.target.filename);
70-
71-
});
72-
});
62+
assert.equal('file', info.target.type)
63+
assert.equal('basics.js', info.target.filename)
64+
})
65+
})
7366

7467
describe('isAlias', function () {
75-
76-
var aliasFile, garbageFile;
68+
var aliasFile, garbageFile
7769

7870
before(function () {
79-
aliasFile = temp.writeFileSync(new Buffer('626f6f6b000000006d61726b00000000', 'hex'));
80-
garbageFile = temp.writeFileSync(new Buffer('Hello my name is Linus!'));
81-
});
71+
aliasFile = temp.writeFileSync(new Buffer('626f6f6b000000006d61726b00000000', 'hex'))
72+
garbageFile = temp.writeFileSync(new Buffer('Hello my name is Linus!'))
73+
})
8274

8375
after(function () {
84-
fs.unlinkSync(aliasFile);
85-
fs.unlinkSync(garbageFile);
86-
});
76+
fs.unlinkSync(aliasFile)
77+
fs.unlinkSync(garbageFile)
78+
})
8779

8880
it('should identify alias', function () {
89-
assert.equal(lib.isAlias(aliasFile), true);
90-
});
81+
assert.equal(lib.isAlias(aliasFile), true)
82+
})
9183

9284
it('should identify non-alias', function () {
93-
assert.equal(lib.isAlias(garbageFile), false);
94-
});
95-
96-
});
85+
assert.equal(lib.isAlias(garbageFile), false)
86+
})
87+
})

0 commit comments

Comments
 (0)