Skip to content

Commit

Permalink
chore: re-arrange exports. (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Jan 30, 2019
1 parent 201c65d commit a15ed54
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions packages/google-cloud-automl/src/v1beta1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
10 changes: 5 additions & 5 deletions packages/google-cloud-automl/synth.metadata
Original file line number Diff line number Diff line change
@@ -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"
}
},
{
Expand Down
140 changes: 70 additions & 70 deletions packages/google-cloud-automl/test/gapic-v1beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a15ed54

Please sign in to comment.