Skip to content

Commit 044603a

Browse files
Revert "fix(microservice) �Delete unnecessary call of grpcClient.start"
1 parent 6045d9e commit 044603a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/microservices/server/server-grpc.ts

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
8181

8282
public async start(callback?: () => void) {
8383
await this.bindEvents();
84+
this.grpcClient.start();
8485
callback();
8586
}
8687

packages/microservices/test/server/server-grpc.spec.ts

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ describe('ServerGrpc', () => {
5151
await server.close();
5252
expect(bindEventsStub.called).to.be.true;
5353
});
54+
it('should call "client.start"', async () => {
55+
const client = { start: sinon.spy() };
56+
sinon.stub(server, 'createClient').callsFake(async () => client);
57+
58+
await server.listen(callback);
59+
expect(client.start.called).to.be.true;
60+
});
5461
it('should call callback', async () => {
5562
await server.listen(callback);
5663
await server.close();
@@ -88,6 +95,12 @@ describe('ServerGrpc', () => {
8895
await serverMulti.close();
8996
expect(bindEventsStub.called).to.be.true;
9097
});
98+
it('should call "client.start"', async () => {
99+
const client = { start: sinon.spy() };
100+
sinon.stub(serverMulti, 'createClient').callsFake(async () => client);
101+
await serverMulti.listen(callback);
102+
expect(client.start.called).to.be.true;
103+
});
91104
it('should call callback', async () => {
92105
await serverMulti.listen(callback);
93106
await serverMulti.close();

0 commit comments

Comments
 (0)