Skip to content

Commit

Permalink
Merge 8b761ae into f8f8f95
Browse files Browse the repository at this point in the history
  • Loading branch information
diasp-ppb committed Feb 14, 2018
2 parents f8f8f95 + 8b761ae commit 3ea630d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
14 changes: 14 additions & 0 deletions src/B2Drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,18 @@ B2Drop.prototype.deleteFolder = function (folderUri, callback)
});
};

B2Drop.prototype.getQuota = function (callback)
{
const self = this;

self.connection.getQuota()
.then(function (resp)
{
return callback(null, resp);
}, function (err)
{
return callback(err, null);
});
}

module.exports.B2Drop = B2Drop;
34 changes: 26 additions & 8 deletions test/b2drop.Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ describe("[B2Drop]", function (done)
{
done("Downloaded file is not equal to mock file. Corrupted transfer?");
}

/* var renamedFilePath = util.pathInApp("/test/mockData/files/test_downloads/zipTest.doc");
fs.rename(testFile.download_location, renamedFilePath, function(err) {
});*/
});
});

Expand Down Expand Up @@ -460,10 +455,33 @@ describe("[B2Drop]", function (done)
});
});

describe("[Quota]", function ()
{
it("Should succesfully get current quota", function (done)
{
var account = new b2drop(b2dropAccount.username, b2dropAccount.password);
account.getQuota(function (err, quota)
{

should.not.exist(err);
should.exist(quota);

if (Object.keys(quota).length === 2)
{
should.exist(quota["used"]);
should.exist(quota["available"]);
done();
}
else
{
done("unnable to getQuota");
}
});
});
});

after(function (done)
{
done();
});
})
;

});

0 comments on commit 3ea630d

Please sign in to comment.