From a15ed54df6a30a58946903aa32dbeaafb0f21087 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot <44816363+yoshi-automation@users.noreply.github.com> Date: Wed, 30 Jan 2019 08:47:47 -0800 Subject: [PATCH] chore: re-arrange exports. (#121) --- .../google-cloud-automl/src/v1beta1/index.js | 4 +- packages/google-cloud-automl/synth.metadata | 10 +- .../google-cloud-automl/test/gapic-v1beta1.js | 140 +++++++++--------- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/packages/google-cloud-automl/src/v1beta1/index.js b/packages/google-cloud-automl/src/v1beta1/index.js index 44868757bf6..09fcf8b3e7d 100644 --- a/packages/google-cloud-automl/src/v1beta1/index.js +++ b/packages/google-cloud-automl/src/v1beta1/index.js @@ -14,8 +14,8 @@ 'use strict'; -const PredictionServiceClient = require('./prediction_service_client'); const AutoMlClient = require('./auto_ml_client'); +const PredictionServiceClient = require('./prediction_service_client'); -module.exports.PredictionServiceClient = PredictionServiceClient; module.exports.AutoMlClient = AutoMlClient; +module.exports.PredictionServiceClient = PredictionServiceClient; diff --git a/packages/google-cloud-automl/synth.metadata b/packages/google-cloud-automl/synth.metadata index 0f965af267c..40feea68893 100644 --- a/packages/google-cloud-automl/synth.metadata +++ b/packages/google-cloud-automl/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-01-17T12:54:55.387640Z", + "updateTime": "2019-01-30T12:07:46.449548Z", "sources": [ { "generator": { "name": "artman", - "version": "0.16.6", - "dockerImage": "googleapis/artman@sha256:12722f2ca3fbc3b53cc6aa5f0e569d7d221b46bd876a2136497089dec5e3634e" + "version": "0.16.7", + "dockerImage": "googleapis/artman@sha256:d6c8ced606eb49973ca95d2af7c55a681acc042db0f87d135968349e7bf6dd80" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "0ac60e21a1aa86c07c1836865b35308ba8178b05", - "internalRef": "229626798" + "sha": "f0195b40fd5f5f412e6819ac01df08cedb8e5fd7", + "internalRef": "231440809" } }, { diff --git a/packages/google-cloud-automl/test/gapic-v1beta1.js b/packages/google-cloud-automl/test/gapic-v1beta1.js index d90af6dc073..fe76fb4f0e7 100644 --- a/packages/google-cloud-automl/test/gapic-v1beta1.js +++ b/packages/google-cloud-automl/test/gapic-v1beta1.js @@ -22,76 +22,6 @@ const FAKE_STATUS_CODE = 1; const error = new Error(); error.code = FAKE_STATUS_CODE; -describe('PredictionServiceClient', () => { - describe('predict', () => { - it('invokes predict without error', done => { - const client = new automlModule.v1beta1.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.modelPath( - '[PROJECT]', - '[LOCATION]', - '[MODEL]' - ); - const payload = {}; - const request = { - name: formattedName, - payload: payload, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.predict = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.predict(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes predict with error', done => { - const client = new automlModule.v1beta1.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.modelPath( - '[PROJECT]', - '[LOCATION]', - '[MODEL]' - ); - const payload = {}; - const request = { - name: formattedName, - payload: payload, - }; - - // Mock Grpc layer - client._innerApiCalls.predict = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.predict(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); -}); describe('AutoMlClient', () => { describe('createDataset', () => { it('invokes createDataset without error', done => { @@ -1215,6 +1145,76 @@ describe('AutoMlClient', () => { }); }); }); +describe('PredictionServiceClient', () => { + describe('predict', () => { + it('invokes predict without error', done => { + const client = new automlModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + const formattedName = client.modelPath( + '[PROJECT]', + '[LOCATION]', + '[MODEL]' + ); + const payload = {}; + const request = { + name: formattedName, + payload: payload, + }; + + // Mock response + const expectedResponse = {}; + + // Mock Grpc layer + client._innerApiCalls.predict = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.predict(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes predict with error', done => { + const client = new automlModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + const formattedName = client.modelPath( + '[PROJECT]', + '[LOCATION]', + '[MODEL]' + ); + const payload = {}; + const request = { + name: formattedName, + payload: payload, + }; + + // Mock Grpc layer + client._innerApiCalls.predict = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.predict(request, (err, response) => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); +}); function mockSimpleGrpcMethod(expectedRequest, response, error) { return function(actualRequest, options, callback) {