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

View file

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