File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ module.exports.overQuota = overQuota
1818
1919const fs = require ( 'fs-extra' )
2020const path = require ( 'path' )
21+ const util = require ( 'util' )
2122const $rdf = require ( 'rdflib' )
2223const from = require ( 'from2' )
2324const url = require ( 'url' )
@@ -284,19 +285,17 @@ function getQuota (root, serverUri) {
284285}
285286
286287async function overQuota ( root , serverUri ) {
287- var actualSize = await _asyncGetSize ( root )
288288 let quota = getQuota ( root , serverUri )
289- console . log ( root )
289+ console . log ( root , quota )
290+ if ( quota === Infinity ) {
291+ return false
292+ }
293+ var actualSize = await _asyncGetSize ( root )
290294 console . log ( actualSize , quota )
291295 return ( actualSize > quota )
292296}
293297
294298function _asyncGetSize ( root ) {
295- return new Promise ( ( resolve , reject ) =>
296- getSize ( root , ( err ) => {
297- reject ( err )
298- } ,
299- ( size ) => {
300- resolve ( size )
301- } ) )
299+ return util . promisify ( getSize ) ( root )
302300}
301+
Original file line number Diff line number Diff line change @@ -25,10 +25,10 @@ describe('Get Quota', function () {
2525
2626describe ( 'Check if over Quota' , function ( ) {
2727 it ( 'Check the quota' , function ( ) {
28- expect ( overQuota ( path . join ( 'test/resources/' , root ) , 'https://localhost' ) ) . to . be . false ( )
28+ expect ( overQuota ( path . join ( 'test/resources/' , root ) , 'https://localhost' ) ) . to . be . true
2929 } )
3030 it ( 'Check the quota with non-existant file' , function ( ) {
31- expect ( overQuota ( path . join ( 'nowhere/' , root ) , 'https://localhost' ) ) . to . be . false ( )
31+ expect ( overQuota ( path . join ( 'nowhere/' , root ) , 'https://localhost' ) ) . to . be . false
3232 } )
3333 it ( 'Check the quota when the predicate is not present' , function ( ) {
3434 expect ( overQuota ( 'test/resources/accounts-acl/quota' , 'https://localhost' ) ) . to . be . false ( )
You can’t perform that action at this time.
0 commit comments