diff --git a/.eslintrc.json b/.eslintrc.json index 74756b38..f2aa94a6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,6 +14,11 @@ "node": true }, "rules": { - "@typescript-eslint/ban-ts-comment": "off" + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": ["warn", { + "varsIgnorePattern": "^_", + "argsIgnorePattern": "^_" + }] } } \ No newline at end of file diff --git a/examples/configuration/src/index.ts b/examples/configuration/src/index.ts index 3bae0b7a..6900b09f 100644 --- a/examples/configuration/src/index.ts +++ b/examples/configuration/src/index.ts @@ -1,13 +1,13 @@ -import { DaprClient, CommunicationProtocolEnum } from "dapr-client"; +import { DaprClient } from "dapr-client"; const daprHost = "127.0.0.1"; -const daprAppId = "example-config"; +const daprPortDefault = "3500"; async function start() { const client = new DaprClient( daprHost, - process.env.DAPR_HTTP_PORT + process.env.DAPR_HTTP_PORT ?? daprPortDefault ); const config = await client.configuration.get('config-store', ['key1', 'key2']); diff --git a/examples/grpc/hello-world/src/index.ts b/examples/grpc/hello-world/src/index.ts index f0e43d24..0db390ff 100644 --- a/examples/grpc/hello-world/src/index.ts +++ b/examples/grpc/hello-world/src/index.ts @@ -2,7 +2,7 @@ import { DaprServer, DaprClient, HttpMethod, CommunicationProtocolEnum } from "d const daprHost = "127.0.0.1"; const daprPort = "50050"; // Dapr Sidecar Port of this Example Server -const daprPortActor = "10002"; // Dapr Sidecar Port of the Actor Server +// const daprPortActor = "10002"; // Dapr Sidecar Port of the Actor Server const serverHost = "127.0.0.1"; // App Host of this Example Server const serverPort = "50051"; // App Port of this Example Server const daprAppId = "example-hello-world"; diff --git a/examples/http/actor/src/index.ts b/examples/http/actor/src/index.ts index c8583120..57b004e3 100644 --- a/examples/http/actor/src/index.ts +++ b/examples/http/actor/src/index.ts @@ -1,4 +1,4 @@ -import { DaprServer, DaprClient, HttpMethod } from "dapr-client"; +import { DaprServer, DaprClient } from "dapr-client"; import DemoActorCounterImpl from "./actor/DemoActorCounterImpl"; import DemoActorReminderImpl from "./actor/DemoActorReminderImpl"; import DemoActorSayImpl from "./actor/DemoActorSayImpl"; @@ -8,7 +8,6 @@ const daprHost = "127.0.0.1"; const daprPort = "50000"; // Dapr Sidecar Port of this Example Server const serverHost = "127.0.0.1"; // App Host of this Example Server const serverPort = "50001"; // App Port of this Example Server -const daprAppId = "example-hello-world"; async function start() { const server = new DaprServer(serverHost, serverPort, daprHost, daprPort); @@ -33,7 +32,6 @@ async function start() { console.log("EXECUTING CLIENT - ACTORS"); console.log("Note: we create new client for now since Actors are not supported internally!") console.log("==============================================================="); - const actorId = "MyActorId1"; const resRegisteredActors = await server.actor.getRegisteredActors(); console.log(`Registered Actor Types: ${JSON.stringify(resRegisteredActors)}`); diff --git a/examples/http/pubsub/src/index.ts b/examples/http/pubsub/src/index.ts index e805f2d7..cd7a535f 100644 --- a/examples/http/pubsub/src/index.ts +++ b/examples/http/pubsub/src/index.ts @@ -4,7 +4,6 @@ const daprHost = "127.0.0.1"; const daprPort = "50000"; // Dapr Sidecar Port of this Example Server const serverHost = "127.0.0.1"; // App Host of this Example Server const serverPort = "50001"; // App Port of this Example Server -const daprAppId = "example-http-pubsub"; async function start() { // Create a Server (will subscribe) and Client (will publish) diff --git a/examples/invocation/src/index.ts b/examples/invocation/src/index.ts index 47748853..33de8655 100644 --- a/examples/invocation/src/index.ts +++ b/examples/invocation/src/index.ts @@ -1,4 +1,4 @@ -import { DaprServer, DaprClient, HttpMethod, CommunicationProtocolEnum } from "dapr-client"; +import { DaprServer, DaprClient, HttpMethod } from "dapr-client"; // Common settings const daprAppId = "example-invocation"; diff --git a/examples/pubsub/src/index.ts b/examples/pubsub/src/index.ts index d81bfcf6..134c7aed 100644 --- a/examples/pubsub/src/index.ts +++ b/examples/pubsub/src/index.ts @@ -1,4 +1,4 @@ -import { DaprServer, DaprClient, CommunicationProtocolEnum } from "dapr-client"; +import { DaprServer, DaprClient } from "dapr-client"; // Common settings const serverHost = "127.0.0.1"; // App Host of this Example Server diff --git a/src/actors/client/ActorClient/ActorClientGRPC.ts b/src/actors/client/ActorClient/ActorClientGRPC.ts index 39bada92..9bb5b92d 100644 --- a/src/actors/client/ActorClient/ActorClientGRPC.ts +++ b/src/actors/client/ActorClient/ActorClientGRPC.ts @@ -69,7 +69,7 @@ export default class ActorClientGRPC implements IClientActor { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.executeActorStateTransaction(msgService, (err, res) => { + client.executeActorStateTransaction(msgService, (err, _res) => { if (err) { return reject(err); } @@ -126,7 +126,7 @@ export default class ActorClientGRPC implements IClientActor { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.registerActorReminder(msgService, (err, res) => { + client.registerActorReminder(msgService, (err, _res) => { if (err) { return reject(err); } @@ -145,7 +145,7 @@ export default class ActorClientGRPC implements IClientActor { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.unregisterActorReminder(msgService, (err, res) => { + client.unregisterActorReminder(msgService, (err, _res) => { if (err) { return reject(err); } @@ -180,7 +180,7 @@ export default class ActorClientGRPC implements IClientActor { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.registerActorTimer(msgService, (err, res) => { + client.registerActorTimer(msgService, (err, _res) => { if (err) { return reject(err); } @@ -199,7 +199,7 @@ export default class ActorClientGRPC implements IClientActor { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.unregisterActorTimer(msgService, (err, res) => { + client.unregisterActorTimer(msgService, (err, _res) => { if (err) { return reject(err); } diff --git a/src/actors/client/ActorProxyBuilder.ts b/src/actors/client/ActorProxyBuilder.ts index cc353638..5db434fe 100644 --- a/src/actors/client/ActorProxyBuilder.ts +++ b/src/actors/client/ActorProxyBuilder.ts @@ -27,7 +27,7 @@ export default class ActorProxyBuilder { const actorClient = this.actorClient; const handler = { - get(target: any, propKey: any, receiver: any) { + get(_target: any, propKey: any, _receiver: any) { return async function (...args: any) { const body = args.length > 0 ? args : null; const res = await actorClient.actor.invoke(actorTypeClassName, actorId, propKey, body); diff --git a/src/actors/runtime/AbstractActor.ts b/src/actors/runtime/AbstractActor.ts index 7676978d..67283227 100644 --- a/src/actors/runtime/AbstractActor.ts +++ b/src/actors/runtime/AbstractActor.ts @@ -71,7 +71,7 @@ export default abstract class AbstractActor { * @param Type of the state object * @return Async void response */ - async registerActorReminder(reminderName: string, dueTime: Temporal.Duration, period: Temporal.Duration, state?: any) { + async registerActorReminder<_Type>(reminderName: string, dueTime: Temporal.Duration, period: Temporal.Duration, state?: any) { await this.actorClient.actor.registerActorReminder(this.actorType, this.id, reminderName, { period, dueTime, @@ -184,7 +184,7 @@ export default abstract class AbstractActor { return; } - async receiveReminder(data: string): Promise { + async receiveReminder(_data: string): Promise { console.warn(JSON.stringify({ error: "ACTOR_METHOD_NOT_IMPLEMENTED", errorMsg: `A reminder was created for the actor with id: ${this.id} but the method 'receiveReminder' was not implemented`, diff --git a/src/implementation/Client/GRPCClient/binding.ts b/src/implementation/Client/GRPCClient/binding.ts index 62b50327..c06c0811 100644 --- a/src/implementation/Client/GRPCClient/binding.ts +++ b/src/implementation/Client/GRPCClient/binding.ts @@ -13,7 +13,7 @@ export default class GRPCClientBinding implements IClientBinding { // Send an event to an external system // @todo: should pass the metadata object // @todo: should return a specific typed Promise instead of Promise - async send(bindingName: string, operation: string, data: any, metadata: object = {}): Promise { + async send(bindingName: string, operation: string, data: any, _metadata: object = {}): Promise { const msgService = new InvokeBindingRequest(); msgService.setName(bindingName); msgService.setOperation(operation); diff --git a/src/implementation/Client/GRPCClient/health.ts b/src/implementation/Client/GRPCClient/health.ts index 9b91f06b..799ff2af 100644 --- a/src/implementation/Client/GRPCClient/health.ts +++ b/src/implementation/Client/GRPCClient/health.ts @@ -13,11 +13,11 @@ export default class GRPCClientHealth implements IClientHealth { // There is no gRPC implementation of /healthz, so we try to fetch the metadata async isHealthy(): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, _reject) => { const client = this.client.getClient(); try { - client.getMetadata(new Empty(), (err, res: GetMetadataResponse) => { + client.getMetadata(new Empty(), (err, _res: GetMetadataResponse) => { if (err) { return resolve(false); } diff --git a/src/implementation/Client/GRPCClient/invoker.ts b/src/implementation/Client/GRPCClient/invoker.ts index 5dd1f353..6eb1e1e6 100644 --- a/src/implementation/Client/GRPCClient/invoker.ts +++ b/src/implementation/Client/GRPCClient/invoker.ts @@ -60,7 +60,6 @@ export default class GRPCClientInvoker implements IClientInvoker { // const res = await fetch(`${this.daprUrl}/invoke/${appId}/method/${methodName}`, fetchOptions); // return ResponseUtil.handleResponse(res); - const resContentType = res.getContentType(); const resData = Buffer.from((res.getData() as Any).getValue()).toString(); try { diff --git a/src/implementation/Client/GRPCClient/metadata.ts b/src/implementation/Client/GRPCClient/metadata.ts index b484f1c7..1757323c 100644 --- a/src/implementation/Client/GRPCClient/metadata.ts +++ b/src/implementation/Client/GRPCClient/metadata.ts @@ -51,7 +51,7 @@ export default class GRPCClientMetadata implements IClientMetadata { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.setMetadata(msg, (err, res: Empty) => { + client.setMetadata(msg, (err, _res: Empty) => { if (err) { return reject(false); } diff --git a/src/implementation/Client/GRPCClient/pubsub.ts b/src/implementation/Client/GRPCClient/pubsub.ts index e12fa88b..6bb0f070 100644 --- a/src/implementation/Client/GRPCClient/pubsub.ts +++ b/src/implementation/Client/GRPCClient/pubsub.ts @@ -19,7 +19,7 @@ export default class GRPCClientPubSub implements IClientPubSub { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.publishEvent(msgService, (err, res) => { + client.publishEvent(msgService, (err, _res) => { if (err) { console.error(err); return reject(false); diff --git a/src/implementation/Client/GRPCClient/secret.ts b/src/implementation/Client/GRPCClient/secret.ts index 3cf1fd34..875a9d18 100644 --- a/src/implementation/Client/GRPCClient/secret.ts +++ b/src/implementation/Client/GRPCClient/secret.ts @@ -11,7 +11,7 @@ export default class GRPCClientSecret implements IClientSecret { } // @todo: implement metadata - async get(secretStoreName: string, key: string, metadata = ""): Promise { + async get(secretStoreName: string, key: string, _metadata = ""): Promise { const msgService = new GetSecretRequest(); msgService.setStoreName(secretStoreName); msgService.setKey(key); diff --git a/src/implementation/Client/GRPCClient/sidecar.ts b/src/implementation/Client/GRPCClient/sidecar.ts index 823c45af..d78b4ef2 100644 --- a/src/implementation/Client/GRPCClient/sidecar.ts +++ b/src/implementation/Client/GRPCClient/sidecar.ts @@ -13,7 +13,7 @@ export default class GRPCClientSidecar implements IClientSidecar { async shutdown(): Promise { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.shutdown(new Empty(), (err, res: Empty) => { + client.shutdown(new Empty(), (err, _res: Empty) => { if (err) { return reject(err); } diff --git a/src/implementation/Client/GRPCClient/state.ts b/src/implementation/Client/GRPCClient/state.ts index 2608c118..9e6bde5c 100644 --- a/src/implementation/Client/GRPCClient/state.ts +++ b/src/implementation/Client/GRPCClient/state.ts @@ -34,7 +34,7 @@ export default class GRPCClientState implements IClientState { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.saveState(msgService, (err, res) => { + client.saveState(msgService, (err, _res) => { if (err) { return reject(err); } @@ -75,7 +75,7 @@ export default class GRPCClientState implements IClientState { }) } - async getBulk(storeName: string, keys: string[], parallelism = 10, metadata = ""): Promise { + async getBulk(storeName: string, keys: string[], parallelism = 10, _metadata = ""): Promise { const msgService = new GetBulkStateRequest(); msgService.setStoreName(storeName); msgService.setKeysList(keys); @@ -122,7 +122,7 @@ export default class GRPCClientState implements IClientState { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.deleteState(msgService, (err, res) => { + client.deleteState(msgService, (err, _res) => { if (err) { return reject(err); } @@ -172,7 +172,7 @@ export default class GRPCClientState implements IClientState { return new Promise((resolve, reject) => { const client = this.client.getClient(); - client.executeStateTransaction(msgService, (err, res) => { + client.executeStateTransaction(msgService, (err, _res) => { if (err) { return reject(err); } diff --git a/src/implementation/Client/HTTPClient/health.ts b/src/implementation/Client/HTTPClient/health.ts index 550a26b8..20c34977 100644 --- a/src/implementation/Client/HTTPClient/health.ts +++ b/src/implementation/Client/HTTPClient/health.ts @@ -12,7 +12,7 @@ export default class HTTPClientHealth implements IClientHealth { // Send an event to an external system async isHealthy(): Promise { try { - const result = await this.client.execute(`/healthz`, { + await this.client.execute(`/healthz`, { method: 'GET', headers: { 'Content-Type': 'application/json', diff --git a/src/implementation/Client/HTTPClient/metadata.ts b/src/implementation/Client/HTTPClient/metadata.ts index eb2ab223..787c498b 100644 --- a/src/implementation/Client/HTTPClient/metadata.ts +++ b/src/implementation/Client/HTTPClient/metadata.ts @@ -16,7 +16,7 @@ export default class HTTPClientMetadata implements IClientMetadata { } async set(key: string, value: string): Promise { - const result = await this.client.execute(`/metadata/${key}`, { + await this.client.execute(`/metadata/${key}`, { method: "PUT", headers: { "Content-Type": "text/plain" diff --git a/src/implementation/Server/GRPCServer/GRPCServer.ts b/src/implementation/Server/GRPCServer/GRPCServer.ts index a37ae20c..d6734b5b 100644 --- a/src/implementation/Server/GRPCServer/GRPCServer.ts +++ b/src/implementation/Server/GRPCServer/GRPCServer.ts @@ -112,7 +112,7 @@ export default class GRPCServer implements IServer { private async initializeBind(): Promise { console.log(`[Dapr-JS][gRPC] Starting to listen on ${this.serverHost}:${this.serverPort}`); return new Promise((resolve, reject) => { - this.server.bindAsync(`${this.serverHost}:${this.serverPort}`, this.serverCredentials, (err, port) => { + this.server.bindAsync(`${this.serverHost}:${this.serverPort}`, this.serverCredentials, (err, _port) => { if (err) { return reject(err); } diff --git a/src/implementation/Server/GRPCServer/actor.ts b/src/implementation/Server/GRPCServer/actor.ts index 38d707e9..1ef9266b 100644 --- a/src/implementation/Server/GRPCServer/actor.ts +++ b/src/implementation/Server/GRPCServer/actor.ts @@ -2,7 +2,6 @@ import GRPCServer from './GRPCServer'; import IServerActor from '../../../interfaces/Server/IServerActor'; import AbstractActor from '../../../actors/runtime/AbstractActor'; import Class from '../../../types/Class'; -import GRPCClient from '../../Client/GRPCClient/GRPCClient'; // https://docs.dapr.io/reference/api/bindings_api/ export default class GRPCServerActor implements IServerActor { @@ -12,7 +11,7 @@ export default class GRPCServerActor implements IServerActor { this.server = server; } - deactivateActor(actorType: string, actorId: string): Promise { + deactivateActor(_actorType: string, _actorId: string): Promise { throw new Error('Method not implemented.'); } @@ -24,7 +23,7 @@ export default class GRPCServerActor implements IServerActor { throw new Error('Method not implemented.'); } - registerActor(cls: Class): Promise { + registerActor(_cls: Class): Promise { throw new Error('Method not implemented.'); } } diff --git a/src/implementation/Server/GRPCServer/binding.ts b/src/implementation/Server/GRPCServer/binding.ts index e27b205f..9abf87fe 100644 --- a/src/implementation/Server/GRPCServer/binding.ts +++ b/src/implementation/Server/GRPCServer/binding.ts @@ -1,7 +1,6 @@ import GRPCServer from './GRPCServer'; import { TypeDaprBindingCallback } from '../../../types/DaprBindingCallback.type'; import IServerBinding from '../../../interfaces/Server/IServerBinding'; -import GRPCClient from '../../Client/GRPCClient/GRPCClient'; // https://docs.dapr.io/reference/api/bindings_api/ export default class DaprBinding implements IServerBinding { diff --git a/src/implementation/Server/GRPCServer/invoker.ts b/src/implementation/Server/GRPCServer/invoker.ts index 6eda4d08..7834b617 100644 --- a/src/implementation/Server/GRPCServer/invoker.ts +++ b/src/implementation/Server/GRPCServer/invoker.ts @@ -3,7 +3,6 @@ import { TypeDaprInvokerCallback } from '../../../types/DaprInvokerCallback.type import { InvokerListenOptionsType } from '../../../types/InvokerListenOptions.type'; import { HttpMethod } from '../../../enum/HttpMethod.enum'; import IServerInvoker from '../../../interfaces/Server/IServerInvoker'; -import GRPCClient from '../../Client/GRPCClient/GRPCClient'; // https://docs.dapr.io/reference/api/service_invocation_api/ export default class DaprInvoker implements IServerInvoker { diff --git a/src/utils/Logger.util.ts b/src/utils/Logger.util.ts index 2ab935dd..d35f4667 100644 --- a/src/utils/Logger.util.ts +++ b/src/utils/Logger.util.ts @@ -18,13 +18,6 @@ const CURRENT_LOGGER_LEVEL = process.env.LOGGER_LEVEL || LoggerLevel.VERBOSE; console.log(`CURRENT LOG LEVEL: ${CURRENT_LOGGER_LEVEL}`) -interface ILoggerMemory { - rss: number; - heapUsed: number; - heapTotal: number; - external: number; -} - export class Logger { static print(level: LoggerLevel, message: string, category = 'Server') { if (level > CURRENT_LOGGER_LEVEL) { diff --git a/test/e2e/actors.http.test.ts b/test/e2e/actors.http.test.ts index ad342ed8..0b764310 100644 --- a/test/e2e/actors.http.test.ts +++ b/test/e2e/actors.http.test.ts @@ -1,4 +1,4 @@ -import { CommunicationProtocolEnum, DaprClient, DaprServer, Temporal } from '../../src'; +import { CommunicationProtocolEnum, DaprClient, DaprServer } from '../../src'; import DemoActorActivateImpl from '../actor/DemoActorActivateImpl'; import DemoActorCounterImpl from '../actor/DemoActorCounterImpl'; diff --git a/test/e2e/main.grpc.test.ts b/test/e2e/main.grpc.test.ts index c00e25c3..7c64d634 100644 --- a/test/e2e/main.grpc.test.ts +++ b/test/e2e/main.grpc.test.ts @@ -9,8 +9,8 @@ const daprAppId = 'test-suite'; describe('grpc/main', () => { let server: DaprServer; let client: DaprClient; - const mockBindingReceive = jest.fn(async (data: object) => console.log('mockBindingReceive')); - const mockPubSubSubscribe = jest.fn(async (data: object) => console.log('mockPubSubSubscribe')); + const mockBindingReceive = jest.fn(async (_data: object) => console.log('mockBindingReceive')); + const mockPubSubSubscribe = jest.fn(async (_data: object) => console.log('mockPubSubSubscribe')); // We need to start listening on some endpoints already // this because Dapr is not dynamic and registers endpoints on boot @@ -34,7 +34,7 @@ describe('grpc/main', () => { describe('metadata', () => { it('should be able to get the metadata of the Dapr sidecar', async () => { - const res = await client.metadata.get(); + await client.metadata.get(); // app id is not set in grpc? // expect(res.id.length).toBeGreaterThan(0); @@ -66,7 +66,7 @@ describe('grpc/main', () => { await client.binding.send('binding-mqtt', 'create', { hello: 'world' }); // Delay a bit for event to arrive - await new Promise((resolve, reject) => setTimeout(resolve, 250)); + await new Promise((resolve, _reject) => setTimeout(resolve, 250)); expect(mockBindingReceive.mock.calls.length).toBe(1); // Also test for receiving data @@ -80,7 +80,7 @@ describe('grpc/main', () => { await client.pubsub.publish('pubsub-redis', 'test-topic', { hello: 'world' }); // Delay a bit for event to arrive - await new Promise((resolve, reject) => setTimeout(resolve, 250)); + await new Promise((resolve, _reject) => setTimeout(resolve, 250)); expect(mockPubSubSubscribe.mock.calls.length).toBe(1); @@ -97,7 +97,7 @@ describe('grpc/main', () => { describe('invoker', () => { it('should be able to listen and invoke a service with GET', async () => { - const mock = jest.fn(async (data: object) => ({ hello: 'world' })); + const mock = jest.fn(async (_data: object) => ({ hello: 'world' })); await server.invoker.listen('hello-world', mock, { method: HttpMethod.GET }); const res = await client.invoker.invoke(daprAppId, 'hello-world', HttpMethod.GET); @@ -110,7 +110,7 @@ describe('grpc/main', () => { }); it('should be able to listen and invoke a service with POST data', async () => { - const mock = jest.fn(async (data: object) => ({ hello: 'world' })); + const mock = jest.fn(async (_data: object) => ({ hello: 'world' })); await server.invoker.listen('hello-world', mock, { method: HttpMethod.POST }); const res = await client.invoker.invoke(daprAppId, 'hello-world', HttpMethod.POST, { diff --git a/test/e2e/main.http.test.ts b/test/e2e/main.http.test.ts index 718e56eb..c2c6b4e9 100644 --- a/test/e2e/main.http.test.ts +++ b/test/e2e/main.http.test.ts @@ -9,8 +9,8 @@ const daprAppId = 'test-suite'; describe('http/main', () => { let server: DaprServer; let client: DaprClient; - const mockBindingReceive = jest.fn(async (data: object) => console.log('mockBindingReceive')); - const mockPubSubSubscribe = jest.fn(async (data: object) => console.log('mockPubSubSubscribe')); + const mockBindingReceive = jest.fn(async (_data: object) => console.log('mockBindingReceive')); + const mockPubSubSubscribe = jest.fn(async (_data: object) => console.log('mockPubSubSubscribe')); // We need to start listening on some endpoints already // this because Dapr is not dynamic and registers endpoints on boot @@ -68,7 +68,7 @@ describe('http/main', () => { await client.binding.send('binding-mqtt', 'create', { hello: 'world' }); // Delay a bit for event to arrive - await new Promise((resolve, reject) => setTimeout(resolve, 250)); + await new Promise((resolve, _reject) => setTimeout(resolve, 250)); expect(mockBindingReceive.mock.calls.length).toBe(1); // Also test for receiving data @@ -82,7 +82,7 @@ describe('http/main', () => { await client.pubsub.publish('pubsub-redis', 'test-topic', { hello: 'world' }); // Delay a bit for event to arrive - await new Promise((resolve, reject) => setTimeout(resolve, 250)); + await new Promise((resolve, _reject) => setTimeout(resolve, 250)); expect(mockPubSubSubscribe.mock.calls.length).toBe(1); @@ -99,7 +99,7 @@ describe('http/main', () => { describe('invoker', () => { it('should be able to listen and invoke a service with GET', async () => { - const mock = jest.fn(async (data: object) => ({ hello: 'world' })); + const mock = jest.fn(async (_data: object) => ({ hello: 'world' })); await server.invoker.listen('hello-world', mock, { method: HttpMethod.GET }); const res = await client.invoker.invoke(daprAppId, 'hello-world', HttpMethod.GET); @@ -112,7 +112,7 @@ describe('http/main', () => { }); it('should be able to listen and invoke a service with POST data', async () => { - const mock = jest.fn(async (data: object) => ({ hello: 'world' })); + const mock = jest.fn(async (_data: object) => ({ hello: 'world' })); await server.invoker.listen('hello-world', mock, { method: HttpMethod.POST }); const res = await client.invoker.invoke(daprAppId, 'hello-world', HttpMethod.POST, { diff --git a/test/unit/actor/actor.test.ts b/test/unit/actor/actor.test.ts index d756b9c1..c96912cd 100644 --- a/test/unit/actor/actor.test.ts +++ b/test/unit/actor/actor.test.ts @@ -14,14 +14,13 @@ describe('Actor', () => { const runtime = ActorRuntime.getInstanceByDaprClient(client); // Reset the runtime config - const config = runtime.getActorRuntimeConfig(); - const newConfig = new ActorRuntimeConfig( + const config = new ActorRuntimeConfig( Temporal.Duration.from({ hours: 1 }) , Temporal.Duration.from({ seconds: 30 }) , Temporal.Duration.from({ minutes: 1 }) , true ); - runtime.setActorRuntimeConfig(newConfig); + runtime.setActorRuntimeConfig(config); // Clear the Actor Managers runtime.clearActorManagers(); diff --git a/test/unit/actor/actorRuntime.test.ts b/test/unit/actor/actorRuntime.test.ts index a470f679..e8e3e70c 100644 --- a/test/unit/actor/actorRuntime.test.ts +++ b/test/unit/actor/actorRuntime.test.ts @@ -19,14 +19,13 @@ describe('ActorRuntime', () => { runtime = ActorRuntime.getInstanceByDaprClient(client); // Reset the runtime config - const config = runtime.getActorRuntimeConfig(); - const newConfig = new ActorRuntimeConfig( + const config = new ActorRuntimeConfig( Temporal.Duration.from({ hours: 1 }) , Temporal.Duration.from({ seconds: 30 }) , Temporal.Duration.from({ minutes: 1 }) , true ); - runtime.setActorRuntimeConfig(newConfig); + runtime.setActorRuntimeConfig(config); // Clear the Actor Managers runtime.clearActorManagers(); @@ -115,10 +114,12 @@ describe('ActorRuntime', () => { }); it('should be able to fire a reminder', async () => { - const actorId = new ActorId(uuidv4()); + // TODO: add this test + new ActorId(uuidv4()); }); it('should be able to fire a timer', async () => { - const actorId = new ActorId(uuidv4()); + // TODO: add this test + new ActorId(uuidv4()); }); }) \ No newline at end of file diff --git a/test/unit/main/DaprClient.test.ts b/test/unit/main/DaprClient.test.ts index b7d05246..d141869f 100644 --- a/test/unit/main/DaprClient.test.ts +++ b/test/unit/main/DaprClient.test.ts @@ -12,7 +12,7 @@ describe('DaprClient', () => { it('should throw an error on a wrong port', () => { try { - const client = new DaprClient(host, host); + new DaprClient(host, host); } catch (e) { const msg = (e as Error).message; expect(msg).toEqual("DAPR_INCORRECT_SIDECAR_PORT"); diff --git a/test/unit/main/DaprServer.test.ts b/test/unit/main/DaprServer.test.ts index 7e4f8136..b3ac4f4d 100644 --- a/test/unit/main/DaprServer.test.ts +++ b/test/unit/main/DaprServer.test.ts @@ -12,7 +12,7 @@ describe('DaprServer', () => { it('should throw an error on a wrong port for server', () => { try { - const server = new DaprServer(host, host); + new DaprServer(host, host); } catch (e) { const msg = (e as Error).message; expect(msg).toEqual("DAPR_INCORRECT_SERVER_PORT"); @@ -21,7 +21,7 @@ describe('DaprServer', () => { it('should throw an error on a wrong port for client', () => { try { - const server = new DaprServer(host, port, host, host); + new DaprServer(host, port, host, host); } catch (e) { const msg = (e as Error).message; expect(msg).toEqual("DAPR_INCORRECT_SIDECAR_PORT");