@@ -17,14 +17,46 @@ describe('LDP', function () {
1717 } ) ;
1818 } ) ;
1919
20+ it ( 'return file if file exists' , function ( done ) {
21+ // file can be empty as well
22+ write ( 'hello world' , 'fileExists.txt' ) ;
23+ ldp . readFile ( __dirname + '/resources/fileExists.txt' , function ( err , file ) {
24+ rm ( 'fileExists.txt' ) ;
25+ assert . notOk ( err ) ;
26+ assert . equal ( file , 'hello world' ) ;
27+ done ( ) ;
28+ } ) ;
29+ } ) ;
2030 } ) ;
2131
22- describe ( 'LDP' , function ( ) {
23-
24- } ) ;
32+ describe ( 'readContainer' , function ( ) {
33+ it ( 'should return 404 if .meta is not found' , function ( done ) {
34+ ldp . readContainerMeta ( 'resources/' , function ( err ) {
35+ assert . equal ( err . status , 404 ) ;
36+ done ( ) ;
37+ } ) ;
38+ } ) ;
2539
26- describe ( 'LDP' , function ( ) {
40+ it ( 'should return content if metaFile exists' , function ( done ) {
41+ // file can be empty as well
42+ write ( '' , '.meta' ) ;
43+ ldp . readContainerMeta ( __dirname + '/resources/' , function ( err , metaFile ) {
44+ rm ( '.meta' ) ;
45+ assert . notOk ( err ) ;
46+ assert . equal ( metaFile , '' ) ;
47+ done ( ) ;
48+ } ) ;
49+ } ) ;
2750
51+ it ( 'should work also if trailing `/` is not passed' , function ( done ) {
52+ // file can be empty as well
53+ write ( '' , '.meta' ) ;
54+ ldp . readContainerMeta ( __dirname + '/resources' , function ( err , metaFile ) {
55+ rm ( '.meta' ) ;
56+ assert . notOk ( err ) ;
57+ assert . equal ( metaFile , '' ) ;
58+ done ( ) ;
59+ } ) ;
60+ } ) ;
2861 } ) ;
29-
3062} ) ;
0 commit comments