diff --git a/test/index.js b/test/index.js index 972c176..0068037 100644 --- a/test/index.js +++ b/test/index.js @@ -52,7 +52,7 @@ describe('decorated-google-drive:', function(){ }); }); }); - describe(' drive.x.upload2: upload a string to appDataFolder ', function(){ + describe(' drive.x.appDataFolder.upload2: upload a string to appDataFolder ', function(){ let uploadResult; before(function(){ return drive.x.appDataFolder.upload2({ @@ -77,7 +77,7 @@ describe('decorated-google-drive:', function(){ found.files[0].id.should.equal(uploadResult.id); }); }); - it("file should have contents Hello-World-Test-1-2-3", function(){ + it("drive.x.appDataFolder.contents should resolve to contents Hello-World-Test-1-2-3", function(){ drive.x.appDataFolder.contents(uploadResult.id).then((contents)=>{ contents.should.be.type("string"); contents.should.equal('Hello-World-Test-1-2-3'); @@ -113,7 +113,7 @@ describe('decorated-google-drive:', function(){ info.mimeType.should.equal("text/plain"); }); }); - it('checking existence on wrong path should throw 404', function(){ + it('checking existence on wrong path should throw Boom.notfound', function(){ // note: folder names seem to ignore upper/lower case return drive.x.findPath("/not/the/path/to/test/Files/README.md").then( (info)=>{ console.log(info); throw new Error("unexpected success"); }, @@ -126,7 +126,7 @@ describe('decorated-google-drive:', function(){ assert.ok(contents.includes("License: MIT")); }); }); - it("drive.x.upload2 uploading the file again with {clobber:false} will throw an error because file already exists", function(){ + it("drive.x.upload2 uploading the file again with {clobber:false} will throw Boom.conflict error because file already exists", function(){ return drive.x.upload2({ folderPath: '/path/to/test/Files/', name: 'README.md', @@ -148,7 +148,7 @@ describe('decorated-google-drive:', function(){ assert.ok(response.deleted); }); }); - it('drive.x.findPath will throw 404 if the file was successfully deleted', function(){ + it('drive.x.findPath will throw Boom.notFound if the file was successfully deleted', function(){ return drive.x.findPath("/path/to/test/Files/README.md").then(janitor).then( (response)=>{ throw new Error("unexpected success");}, (e)=>{ if (e.isBoom && e.typeof===Boom.notFound) return Promise.resolve("ok"); throw e; } diff --git a/testResults.txt b/testResults.txt index 7f7f567..40b655a 100644 --- a/testResults.txt +++ b/testResults.txt @@ -4,25 +4,25 @@ initializing ✓ should not throw an error drive.x.aboutMe - ✓ should return the test users email address (526ms) - ✓ should return a storageQuota object with properties limit, usage (181ms) - drive.x.upload2: upload a string to appDataFolder + ✓ should return the test users email address (401ms) + ✓ should return a storageQuota object with properties limit, usage (185ms) + drive.x.appDataFolder.upload2: upload a string to appDataFolder ✓ uploading the string to appDataFolder file myaccount should resolve with expected file metadata ✓ drive.x.appDataFolder.searcher should report there is exactly one myaccount file in the folder and it should match upload file id - ✓ file should have contents Hello-World-Test-1-2-3 + ✓ drive.x.appDataFolder.contents should resolve to contents Hello-World-Test-1-2-3 drive.x.upload2: upload a file README.md to Drive folder /path/to/test/Files ✓ uploading the README.md file to /path/to/test/Files/README.md should resolve with expected file metadata after drive.x.upload2 - ✓ checking existence with drive.x.findPath should yield expected file metadata (1071ms) - ✓ checking existence on wrong path should throw 404 (187ms) - ✓ downloading content with drive.x.download should yield contents string including 'License: MIT' (1223ms) - ✓ drive.x.upload2 uploading the file again with {clobber:false} will throw an error because file already exists (1153ms) + ✓ checking existence with drive.x.findPath should yield expected file metadata (1018ms) + ✓ checking existence on wrong path should throw Boom.notfound (196ms) + ✓ downloading content with drive.x.download should yield contents string including 'License: MIT' (1579ms) + ✓ drive.x.upload2 uploading the file again with {clobber:false} will throw Boom.conflict error because file already exists (1104ms) cleanup via drive.x.janitor - ✓ janitor hopefully deletes the README.md file(s) OK and resolves correctly (1510ms) - ✓ drive.x.findPath will throw 404 if the file was successfully deleted (1160ms) - ✓ janitor will throw an error if told to delete an invalid file (149ms) + ✓ janitor hopefully deletes the README.md file(s) OK and resolves correctly (1336ms) + ✓ drive.x.findPath will throw Boom.notFound if the file was successfully deleted (1018ms) + ✓ janitor will throw an error if told to delete an invalid file (148ms) ✓ janitor should not throw an error if given an empty filelist - ✓ final cleanup: delete the path folder and check non-existence (967ms) + ✓ final cleanup: delete the path folder and check non-existence (1035ms) 16 passing (13s)