Revert "fix(microservice) Delete unnecessary call of grpcClient.start"

This commit is contained in:
Kamil Mysliwiec
2024-04-19 09:13:10 +02:00
committed by GitHub
parent 6045d9e423
commit 044603ab7b
2 changed files with 14 additions and 0 deletions

View File

@@ -81,6 +81,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
public async start(callback?: () => void) {
await this.bindEvents();
this.grpcClient.start();
callback();
}

View File

@@ -51,6 +51,13 @@ describe('ServerGrpc', () => {
await server.close();
expect(bindEventsStub.called).to.be.true;
});
it('should call "client.start"', async () => {
const client = { start: sinon.spy() };
sinon.stub(server, 'createClient').callsFake(async () => client);
await server.listen(callback);
expect(client.start.called).to.be.true;
});
it('should call callback', async () => {
await server.listen(callback);
await server.close();
@@ -88,6 +95,12 @@ describe('ServerGrpc', () => {
await serverMulti.close();
expect(bindEventsStub.called).to.be.true;
});
it('should call "client.start"', async () => {
const client = { start: sinon.spy() };
sinon.stub(serverMulti, 'createClient').callsFake(async () => client);
await serverMulti.listen(callback);
expect(client.start.called).to.be.true;
});
it('should call callback', async () => {
await serverMulti.listen(callback);
await serverMulti.close();