diff --git a/asset/snippets/system-test/quickstart.test.js b/asset/snippets/system-test/quickstart.test.js index de7fa6d803f..6066942c031 100644 --- a/asset/snippets/system-test/quickstart.test.js +++ b/asset/snippets/system-test/quickstart.test.js @@ -18,7 +18,6 @@ const assert = require('assert'); const path = require('path'); const tools = require('@google-cloud/nodejs-repo-tools'); -const util = require('util'); const uuid = require('uuid'); const cwd = path.join(__dirname, '..'); const cmd = 'node quickstart.js'; @@ -29,20 +28,33 @@ const storage = new Storage(); const bucketName = `asset-nodejs-${uuid.v4()}`; const bucket = storage.bucket(bucketName); -describe('Quickstart sample tests', () => { +describe('quickstart sample tests', () => { + before(tools.checkCredentials); before(async () => { - tools.checkCredentials(); await bucket.create(); }); - after(async () => await bucket.delete()); + after(async () => { + await bucket.delete(); + }); it('should export assets to specified path', async () => { - const dumpFilePath = util.format('gs://%s/my-assets.txt', bucketName); + const dumpFilePath = `gs://${bucketName}/my-assets.txt`; await tools.runAsyncWithIO(`${cmd} export-assets ${dumpFilePath}`, cwd); const file = await bucket.file('my-assets.txt'); - const [exists] = await file.exists(); + const exists = await file.exists(); assert.ok(exists); await file.delete(); }); + + it('should get assets history successfully', async () => { + const assetName = `//storage.googleapis.com/${bucketName}`; + const output = await tools.runAsyncWithIO( + `${cmd} batch-get-history ${assetName}`, + cwd + ); + if (output.stdout) { + assert.ok(output.stdout.includes(assetName)); + } + }); });