Rename incorrectly-named 'getDirectorySize' method

This commit is contained in:
Simon Detheridge 2020-01-06 15:35:40 +00:00
parent a6d9d34fe3
commit b642b3cf3a
2 changed files with 6 additions and 8 deletions

View file

@ -23,7 +23,7 @@ module.exports = {
deleteFile: callbackify(deleteFile),
copyFile: callbackify(copyFile),
checkIfFileExists: callbackify(checkIfFileExists),
getDirectorySize: callbackify(getDirectorySize),
directorySize: callbackify(directorySize),
promises: {
sendFile,
sendStream,
@ -33,7 +33,7 @@ module.exports = {
deleteFile,
copyFile,
checkIfFileExists,
getDirectorySize
directorySize
}
}
@ -209,7 +209,7 @@ async function checkIfFileExists(bucketName, key) {
}
}
async function getDirectorySize(bucketName, key) {
async function directorySize(bucketName, key) {
try {
const response = await _client
.listObjects({ Bucket: bucketName, Prefix: key })

View file

@ -186,7 +186,6 @@ describe('S3PersistorManagerTests', function() {
S3ReadStream.on.withArgs('error').yields(S3NotFoundError)
try {
stream = await S3PersistorManager.promises.getFileStream(bucket, key)
console.log(stream)
} catch (err) {
error = err
}
@ -217,7 +216,6 @@ describe('S3PersistorManagerTests', function() {
S3ReadStream.on.withArgs('error').yields(genericError)
try {
stream = await S3PersistorManager.promises.getFileStream(bucket, key)
console.log(stream)
} catch (err) {
error = err
}
@ -581,7 +579,7 @@ describe('S3PersistorManagerTests', function() {
let size
beforeEach(async function() {
size = await S3PersistorManager.promises.getDirectorySize(bucket, key)
size = await S3PersistorManager.promises.directorySize(bucket, key)
})
it('should list the objects in the directory', function() {
@ -603,7 +601,7 @@ describe('S3PersistorManagerTests', function() {
S3Client.listObjects = sinon
.stub()
.returns({ promise: sinon.stub().resolves({ Contents: [] }) })
size = await S3PersistorManager.promises.getDirectorySize(bucket, key)
size = await S3PersistorManager.promises.directorySize(bucket, key)
})
it('should list the objects in the directory', function() {
@ -626,7 +624,7 @@ describe('S3PersistorManagerTests', function() {
.stub()
.returns({ promise: sinon.stub().rejects(genericError) })
try {
await S3PersistorManager.promises.getDirectorySize(bucket, key)
await S3PersistorManager.promises.directorySize(bucket, key)
} catch (err) {
error = err
}