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
98var rawData = new Buffer (
109 "AAAAAAEqAAIAAApUZXN0IFRpdGxlAAAAAAAAAAAAAAAAAAAAAADO615USCsA" +
@@ -14,27 +13,26 @@ var rawData = new Buffer(
1413 "c3QgVGl0bGU6LmJhY2tncm91bmQ6AFRlc3RCa2cudGlmZgAPABYACgBUAGUA" +
1514 "cwB0ACAAVABpAHQAbABlABIAGS8uYmFja2dyb3VuZC9UZXN0QmtnLnRpZmYA" +
1615 "ABMAEy9Wb2x1bWVzL1Rlc3QgVGl0bGUA//8AAA==" , 'base64'
17- ) ;
16+ )
1817
1918describe ( '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
5148describe ( '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
6257describe ( '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
7467describe ( '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