Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.instance = new Test();
this.provider = {
store: {
get: Sinon.stub()
}
};
Store.from(Test).set("socketIO", {
handlers: {
use: "use"
}
});
this.getStub = Sinon.stub(injector as any, "getProvider").returns({
instance: this.instance,
type: ProviderType.MIDDLEWARE,
store: {
get() {
return MiddlewareType.ERROR;
}
}
});
this.scope = {scope: "scope"};
this.error = new Error("test");
this.builder = new SocketHandlersBuilder(this.provider, {} as any, injector);
this.invokeStub = Sinon.stub(this.builder, "invoke").resolves();
return this.builder.bindMiddleware({target: "target"}, this.scope, Promise.reject(this.error));
})
);
this.instance = new Test();
this.provider = {
store: {
get: Sinon.stub()
}
};
Store.from(Test).set("socketIO", {
handlers: {
use: "use"
}
});
this.getStub = Sinon.stub(injector as any, "getProvider").returns({
instance: this.instance,
type: ProviderType.MIDDLEWARE,
store: {
get() {
return MiddlewareType.MIDDLEWARE;
}
}
});
this.scope = {scope: "scope"};
this.builder = new SocketHandlersBuilder(this.provider, {} as any, injector);
this.invokeStub = Sinon.stub(this.builder, "invoke").returns({result: "result"});
return this.builder.bindMiddleware({target: "target"}, this.scope, Promise.resolve());
})
);
before(() => {
this.handlerMetadata = {
type: ProviderType.MIDDLEWARE,
target: "target"
};
this.handlerBuilder = new HandlerBuilder(this.handlerMetadata);
this.buildHandlerStub = Sinon.stub(this.handlerBuilder, "buildHandler");
this.buildHandlerStub.returns("handlerMiddleware");
this.result = this.handlerBuilder.getHandler();
});
constructor(private injectorService: InjectorService) {
super(injectorService, {filter: {type: ProviderType.MIDDLEWARE}});
}