Skip to content

Commit

Permalink
grpc-js: Simplify client.waitForReady tests. Refs #1352
Browse files Browse the repository at this point in the history
No need to add a service to the server to test the client.
  • Loading branch information
badsyntax committed Apr 20, 2020
1 parent 615a3c6 commit 9d1e8be
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions packages/grpc-js/test/test-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,29 @@
*
*/

// Allow `any` data type for testing runtime type checking.
// tslint:disable no-any
import * as assert from 'assert';
import * as path from 'path';

import * as grpc from '../src';
import { Server, ServerCredentials } from '../src';
import { ServiceClient, ServiceClientConstructor } from '../src/make-client';
import { sendUnaryData, ServerUnaryCall } from '../src/server-call';

import { loadProtoFile } from './common';
import { Client } from '../src';
import { ConnectivityState } from '../src/channel';

const clientInsecureCreds = grpc.credentials.createInsecure();
const serverInsecureCreds = ServerCredentials.createInsecure();

describe('Client', () => {
let server: Server;
let client: ServiceClient;
let client: Client;

before(done => {
const protoFile = path.join(__dirname, 'fixtures', 'echo_service.proto');
const echoService = loadProtoFile(protoFile)
.EchoService as ServiceClientConstructor;

server = new Server();

server.bindAsync(
'localhost:0',
serverInsecureCreds,
(err, port) => {
assert.ifError(err);
client = new echoService(
client = new Client(
`localhost:${port}`,
clientInsecureCreds
);
Expand Down

0 comments on commit 9d1e8be

Please sign in to comment.