Fix backup.download tests

This commit is contained in:
Girish Ramakrishnan
2023-07-28 13:15:08 +05:30
parent 99bc30ad07
commit 0ab4bc543f

View File

@@ -102,23 +102,19 @@ describe('Storage', function () {
});
});
it('can download file', function (done) {
it('can download file', async function () {
const sourceFile = gTmpFolder + '/uploadtest/test.txt';
filesystem.download(gBackupConfig, sourceFile, function (error, stream) {
expect(error).to.be(null);
expect(stream).to.be.an('object');
done();
});
const [error, stream] = await safe(filesystem.download(gBackupConfig, sourceFile));
expect(error).to.be(null);
expect(stream).to.be.an('object');
});
it('download errors for missing file', function (done) {
it('download errors for missing file', async function () {
const sourceFile = gTmpFolder + '/uploadtest/missing';
filesystem.download(gBackupConfig, sourceFile, function (error) {
expect(error.reason).to.be(BoxError.NOT_FOUND);
done();
});
const [error] = await safe(filesystem.download(gBackupConfig, sourceFile));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});
it('list dir lists the source dir', function (done) {
@@ -173,11 +169,9 @@ describe('Storage', function () {
});
});
it('can download file', function (done) {
noop.download(gBackupConfig, 'file', function (error) {
expect(error).to.be.an(Error);
done();
});
it('can download file', async function () {
const [error] = await safe(noop.download(gBackupConfig, 'file'));
expect(error).to.be.an(Error);
});
it('list dir contents of source dir', function (done) {
@@ -237,13 +231,11 @@ describe('Storage', function () {
});
});
it('can download file', function (done) {
it('can download file', async function () {
const sourceKey = 'uploadtest/test.txt';
s3.download(gBackupConfig, sourceKey, function (error, stream) {
expect(error).to.be(null);
expect(stream).to.be.an('object');
done();
});
const [error, stream] = await safe(s3.download(gBackupConfig, sourceKey));
expect(error).to.be(null);
expect(stream).to.be.an('object');
});
it('list dir lists contents of source dir', function (done) {
@@ -379,13 +371,11 @@ describe('Storage', function () {
});
});
it('can download file', function (done) {
it('can download file', async function () {
const sourceKey = 'uploadtest/test.txt';
gcs.download(gBackupConfig, sourceKey, function (error, stream) {
expect(error).to.be(null);
expect(stream).to.be.an('object');
done();
});
const [error, stream] = await safe(gcs.download(gBackupConfig, sourceKey));
expect(error).to.be(null);
expect(stream).to.be.an('object');
});
it('list dir lists contents of source dir', function (done) {