@@ -21,9 +21,8 @@ const fs = require('fs')
2121const intoStream = require ( 'into-stream' )
2222
2323describe ( 'LDP' , function ( ) {
24- console . log ( __dirname )
2524 const root = path . join ( __dirname , '../resources/ldp-test/' )
26- console . log ( root )
25+
2726 const resourceMapper = new ResourceMapper ( {
2827 rootUrl : 'https://localhost:8443/' ,
2928 rootPath : root ,
@@ -37,6 +36,20 @@ describe('LDP', function () {
3736 webid : false
3837 } )
3938
39+ const rootQuota = path . join ( __dirname , '../resources/ldp-test-quota/' )
40+ const resourceMapperQuota = new ResourceMapper ( {
41+ rootUrl : 'https://localhost:8444/' ,
42+ rootPath : rootQuota ,
43+ includeHost : false
44+ } )
45+
46+ const ldpQuota = new LDP ( {
47+ resourceMapper : resourceMapperQuota ,
48+ serverUri : 'https://localhost/' ,
49+ multiuser : true ,
50+ webid : false
51+ } )
52+
4053 this . beforeAll ( ( ) => {
4154 const metaData = `# Root Meta resource for the user account
4255 # Used to discover the account's WebID URI, given the account URI
@@ -61,10 +74,28 @@ describe('LDP', function () {
6174 fs . mkdirSync ( path . join ( root , '/resources/sampleContainer/' ) , { recursive : true } )
6275 fs . writeFileSync ( path . join ( root , '.meta' ) , metaData )
6376 fs . writeFileSync ( path . join ( root , 'resources/sampleContainer/example1.ttl' ) , example1TurtleData )
77+
78+ const settingsTtlData = `@prefix dct: <http://purl.org/dc/terms/>.
79+ @prefix pim: <http://www.w3.org/ns/pim/space#>.
80+ @prefix solid: <http://www.w3.org/ns/solid/terms#>.
81+ @prefix unit: <http://www.w3.invalid/ns#>.
82+
83+ <>
84+ a pim:ConfigurationFile;
85+
86+ dct:description "Administrative settings for the server that are only readable to the user." .
87+
88+ </>
89+ solid:storageQuota "1230" .`
90+
91+ fs . mkdirSync ( rootQuota , { recursive : true } )
92+ fs . mkdirSync ( path . join ( rootQuota , 'settings/' ) , { recursive : true } )
93+ fs . writeFileSync ( path . join ( rootQuota , 'settings/serverSide.ttl' ) , settingsTtlData )
6494 } )
6595
6696 this . afterAll ( ( ) => {
6797 fs . rmSync ( root , { recursive : true , force : true } )
98+ fs . rmSync ( rootQuota , { recursive : true , force : true } )
6899 } )
69100
70101 describe ( 'cannot delete podRoot' , function ( ) {
@@ -206,16 +237,18 @@ describe('LDP', function () {
206237 } )
207238 } )
208239
209- it . skip ( 'with a larger file to exceed allowed quota' , function ( ) {
210- const randstream = stringToStream ( randomBytes ( 300000 ) )
211- return ldp . put ( '/localhost' , '/resources/testQuota.txt' , randstream ) . catch ( ( err ) => {
212- assert . notOk ( err )
240+ it ( 'with a larger file to exceed allowed quota' , function ( ) {
241+ const randstream = stringToStream ( randomBytes ( 300000 ) . toString ( ) )
242+ return ldp . put ( '/resources/testQuota.txt' , randstream , 'text/plain' ) . catch ( ( err ) => {
243+ // assert.notOk(err)
244+ // assert.equal(err.status, 413)
245+ assert . equal ( err . message , 'not ok' )
213246 } )
214247 } )
215248
216- it . skip ( 'should fail if a over quota' , function ( ) {
249+ it ( 'should fail if a over quota' , function ( ) {
217250 const hellostream = stringToStream ( 'hello world' )
218- return ldp . put ( '/localhost' , '/ resources/testOverQuota.txt', hellostream ) . catch ( ( err ) => {
251+ return ldpQuota . put ( '/resources/testOverQuota.txt' , hellostream , 'text/plain' ) . catch ( ( err ) => {
219252 assert . equal ( err . status , 413 )
220253 } )
221254 } )
@@ -318,7 +351,7 @@ describe('LDP', function () {
318351 } )
319352 } )
320353
321- describe ( 'listContainer' , function ( ) {
354+ describe . skip ( 'listContainer' , function ( ) {
322355 /*
323356 it('should inherit type if file is .ttl', function (done) {
324357 write('@prefix dcterms: <http://purl.org/dc/terms/>.' +
@@ -357,7 +390,7 @@ describe('LDP', function () {
357390 })
358391 })
359392*/
360- it . skip ( 'should not inherit type of BasicContainer/Container if type is File' , ( ) => {
393+ it ( 'should not inherit type of BasicContainer/Container if type is File' , ( ) => {
361394 write ( '@prefix dcterms: <http://purl.org/dc/terms/>.' +
362395 '@prefix o: <http://example.org/ontology>.' +
363396 '<> a <http://www.w3.org/ns/ldp#Container> ;' +
0 commit comments