Skip to content

Commit

Permalink
fix: generated test fixes (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster committed Nov 21, 2019
1 parent cc66e49 commit cac5ca4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class Operation{
promise() {};
}

{%- if (service.simpleMethods.length > 0) %}
function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}, options: {}, callback: Callback) => {
assert.deepStrictEqual(actualRequest, expectedRequest);
Expand All @@ -58,6 +59,7 @@ function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: F
}
};
}
{%- endif %}
{%- if (service.serverStreaming.length > 0) %}
function mockServerStreamingGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}) => {
Expand Down Expand Up @@ -116,7 +118,7 @@ function mockLongRunningGrpcMethod(expectedRequest: {}, response: {} | null, err
};
}
{%- endif %}
describe('{{ service.name }}Client', () => {
describe('{{ api.naming.version }}.{{ service.name }}Client', () => {
it('has servicePath', () => {
const servicePath = {{ service.name.toLowerCase() }}Module.{{ api.naming.version }}.{{ service.name }}Client.servicePath;
assert(servicePath);
Expand All @@ -134,7 +136,7 @@ describe('{{ service.name }}Client', () => {
const client = new {{ service.name.toLowerCase() }}Module.{{ api.naming.version }}.{{ service.name }}Client();
assert(client);
});
it('should create a client with gRPC option', () => {
it('should create a client with gRPC fallback', () => {
const client = new {{ service.name.toLowerCase() }}Module.{{ api.naming.version }}.{{ service.name }}Client({
fallback: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class Operation{
constructor(){};
promise() {};
}

function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}, options: {}, callback: Callback) => {
assert.deepStrictEqual(actualRequest, expectedRequest);
Expand All @@ -54,7 +53,7 @@ function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: F
}
};
}
describe('KeyManagementServiceClient', () => {
describe('v1.KeyManagementServiceClient', () => {
it('has servicePath', () => {
const servicePath = keymanagementserviceModule.v1.KeyManagementServiceClient.servicePath;
assert(servicePath);
Expand All @@ -72,7 +71,7 @@ describe('KeyManagementServiceClient', () => {
const client = new keymanagementserviceModule.v1.KeyManagementServiceClient();
assert(client);
});
it('should create a client with gRPC option', () => {
it('should create a client with gRPC fallback', () => {
const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({
fallback: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class Operation{
constructor(){};
promise() {};
}

function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}, options: {}, callback: Callback) => {
assert.deepStrictEqual(actualRequest, expectedRequest);
Expand Down Expand Up @@ -72,7 +71,7 @@ function mockLongRunningGrpcMethod(expectedRequest: {}, response: {} | null, err
return Promise.resolve([mockOperation]);
};
}
describe('CloudRedisClient', () => {
describe('v1beta1.CloudRedisClient', () => {
it('has servicePath', () => {
const servicePath = cloudredisModule.v1beta1.CloudRedisClient.servicePath;
assert(servicePath);
Expand All @@ -90,7 +89,7 @@ describe('CloudRedisClient', () => {
const client = new cloudredisModule.v1beta1.CloudRedisClient();
assert(client);
});
it('should create a client with gRPC option', () => {
it('should create a client with gRPC fallback', () => {
const client = new cloudredisModule.v1beta1.CloudRedisClient({
fallback: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class Operation{
constructor(){};
promise() {};
}

function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}, options: {}, callback: Callback) => {
assert.deepStrictEqual(actualRequest, expectedRequest);
Expand Down Expand Up @@ -108,7 +107,7 @@ function mockLongRunningGrpcMethod(expectedRequest: {}, response: {} | null, err
return Promise.resolve([mockOperation]);
};
}
describe('EchoClient', () => {
describe('v1beta1.EchoClient', () => {
it('has servicePath', () => {
const servicePath = echoModule.v1beta1.EchoClient.servicePath;
assert(servicePath);
Expand All @@ -126,7 +125,7 @@ describe('EchoClient', () => {
const client = new echoModule.v1beta1.EchoClient();
assert(client);
});
it('should create a client with gRPC option', () => {
it('should create a client with gRPC fallback', () => {
const client = new echoModule.v1beta1.EchoClient({
fallback: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class Operation{
constructor(){};
promise() {};
}

function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}, options: {}, callback: Callback) => {
assert.deepStrictEqual(actualRequest, expectedRequest);
Expand All @@ -54,7 +53,7 @@ function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: F
}
};
}
describe('TextToSpeechClient', () => {
describe('v1.TextToSpeechClient', () => {
it('has servicePath', () => {
const servicePath = texttospeechModule.v1.TextToSpeechClient.servicePath;
assert(servicePath);
Expand All @@ -72,7 +71,7 @@ describe('TextToSpeechClient', () => {
const client = new texttospeechModule.v1.TextToSpeechClient();
assert(client);
});
it('should create a client with gRPC option', () => {
it('should create a client with gRPC fallback', () => {
const client = new texttospeechModule.v1.TextToSpeechClient({
fallback: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class Operation{
constructor(){};
promise() {};
}

function mockSimpleGrpcMethod(expectedRequest: {}, response: {} | null, error: FakeError | null) {
return (actualRequest: {}, options: {}, callback: Callback) => {
assert.deepStrictEqual(actualRequest, expectedRequest);
Expand Down Expand Up @@ -72,7 +71,7 @@ function mockLongRunningGrpcMethod(expectedRequest: {}, response: {} | null, err
return Promise.resolve([mockOperation]);
};
}
describe('TranslationServiceClient', () => {
describe('v3beta1.TranslationServiceClient', () => {
it('has servicePath', () => {
const servicePath = translationserviceModule.v3beta1.TranslationServiceClient.servicePath;
assert(servicePath);
Expand All @@ -90,7 +89,7 @@ describe('TranslationServiceClient', () => {
const client = new translationserviceModule.v3beta1.TranslationServiceClient();
assert(client);
});
it('should create a client with gRPC option', () => {
it('should create a client with gRPC fallback', () => {
const client = new translationserviceModule.v3beta1.TranslationServiceClient({
fallback: true,
});
Expand Down

0 comments on commit cac5ca4

Please sign in to comment.