From 0bb6fbce3f6542bd9a007da47a6f0c9d58250732 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot <44816363+yoshi-automation@users.noreply.github.com> Date: Tue, 5 Feb 2019 08:25:41 -0800 Subject: [PATCH] test: update code style of smoke test (#463) --- smoke-test/publisher_smoke_test.js | 18 +++++++----------- src/v1/publisher_client.js | 16 ++++++++-------- src/v1/subscriber_client.js | 16 ++++++++-------- synth.metadata | 10 +++++----- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/smoke-test/publisher_smoke_test.js b/smoke-test/publisher_smoke_test.js index b1b5a977e..cce42c0d3 100644 --- a/smoke-test/publisher_smoke_test.js +++ b/smoke-test/publisher_smoke_test.js @@ -34,8 +34,8 @@ describe('PublisherSmokeTest', () => { .listTopics({project: formattedProject}) .then(responses => { const resources = responses[0]; - for (let i = 0; i < resources.length; i += 1) { - console.log(resources[i]); + for (const resource of resources) { + console.log(resource); } }) .then(done) @@ -60,8 +60,8 @@ describe('PublisherSmokeTest', () => { const nextRequest = responses[1]; // The actual response object, if necessary. // const rawResponse = responses[2]; - for (let i = 0; i < resources.length; i += 1) { - console.log(resources[i]); + for (const resource of resources) { + console.log(resource); } if (nextRequest) { // Fetch the next page. @@ -83,16 +83,12 @@ describe('PublisherSmokeTest', () => { }); const formattedProject = client.projectPath(projectId); - let counter = 0; client .listTopicsStream({project: formattedProject}) - .on('data', () => { - ++counter; + .on('data', element => { + console.log(element); }) .on('error', done) - .on('end', () => { - console.log(`${counter} elements received.`); - done(); - }); + .on('end', done); }); }); diff --git a/src/v1/publisher_client.js b/src/v1/publisher_client.js index c76c1fbf0..0743a4cd9 100644 --- a/src/v1/publisher_client.js +++ b/src/v1/publisher_client.js @@ -562,8 +562,8 @@ class PublisherClient { * client.listTopics({project: formattedProject}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]) + * for (const resource of resources) { + * // doThingsWith(resource) * } * }) * .catch(err => { @@ -582,8 +582,8 @@ class PublisherClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]); + * for (const resource of resources) { + * // doThingsWith(resource); * } * if (nextRequest) { * // Fetch the next page. @@ -713,8 +713,8 @@ class PublisherClient { * client.listTopicSubscriptions({topic: formattedTopic}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]) + * for (const resource of resources) { + * // doThingsWith(resource) * } * }) * .catch(err => { @@ -733,8 +733,8 @@ class PublisherClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]); + * for (const resource of resources) { + * // doThingsWith(resource); * } * if (nextRequest) { * // Fetch the next page. diff --git a/src/v1/subscriber_client.js b/src/v1/subscriber_client.js index a108eb30b..0520bcad0 100644 --- a/src/v1/subscriber_client.js +++ b/src/v1/subscriber_client.js @@ -574,8 +574,8 @@ class SubscriberClient { * client.listSubscriptions({project: formattedProject}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]) + * for (const resource of resources) { + * // doThingsWith(resource) * } * }) * .catch(err => { @@ -594,8 +594,8 @@ class SubscriberClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]); + * for (const resource of resources) { + * // doThingsWith(resource); * } * if (nextRequest) { * // Fetch the next page. @@ -1053,8 +1053,8 @@ class SubscriberClient { * client.listSnapshots({project: formattedProject}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]) + * for (const resource of resources) { + * // doThingsWith(resource) * } * }) * .catch(err => { @@ -1073,8 +1073,8 @@ class SubscriberClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { - * // doThingsWith(resources[i]); + * for (const resource of resources) { + * // doThingsWith(resource); * } * if (nextRequest) { * // Fetch the next page. diff --git a/synth.metadata b/synth.metadata index e85141431..cb3539f9f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-01-26T12:16:21.653703Z", + "updateTime": "2019-02-05T12:16:03.207914Z", "sources": [ { "generator": { "name": "artman", - "version": "0.16.7", - "dockerImage": "googleapis/artman@sha256:d6c8ced606eb49973ca95d2af7c55a681acc042db0f87d135968349e7bf6dd80" + "version": "0.16.9", + "dockerImage": "googleapis/artman@sha256:80c39fa84e7203c8f355e01bdeef82155013cc39dcaa48fba7a6fe2c253623e3" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "a6b4398490269577fc511f297b85763ba4701403", - "internalRef": "230969086" + "sha": "f26c727dde5051abefc5ad9e7dee82a2686ad2b0", + "internalRef": "232306662" } }, {