Skip to content

[Workflow] Renamed the workflow methods #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/implementation/Client/GRPCClient/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
import { WorkflowGetResponseType } from "../../../types/workflow/WorkflowGetResponse.type";
import { GRPCNotSupportedError } from "../../../errors/GRPCNotSupportedError";

export default class GRPCClientWorkflow implements IClientWorkflow {

Check failure on line 19 in src/implementation/Client/GRPCClient/workflow.ts

View workflow job for this annotation

GitHub Actions / build (16.14.0)

Class 'GRPCClientWorkflow' incorrectly implements interface 'IClientWorkflow'.

Check failure on line 19 in src/implementation/Client/GRPCClient/workflow.ts

View workflow job for this annotation

GitHub Actions / test-e2e

Class 'GRPCClientWorkflow' incorrectly implements interface 'IClientWorkflow'.
client: GRPCClient;

constructor(client: GRPCClient) {
this.client = client;
}

get(_instanceId: string): Promise<WorkflowGetResponseType> {
getWorkflowState(_instanceId: string, _workflowComponent?: string | undefined): Promise<WorkflowGetResponseType> {
throw new GRPCNotSupportedError();
}

start(
scheduleNewWorkflow(
_workflowName: string,
_input?: any,
_instanceId?: string | undefined
Expand Down
4 changes: 2 additions & 2 deletions src/implementation/Client/HTTPClient/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import { WorkflowRaiseOptions } from "../../../types/workflow/WorkflowRaiseOptions.type";
import { PropertyRequiredError } from "../../../errors/PropertyRequiredError";

export default class HTTPClientWorkflow implements IClientWorkflow {

Check failure on line 25 in src/implementation/Client/HTTPClient/workflow.ts

View workflow job for this annotation

GitHub Actions / build (16.14.0)

Class 'HTTPClientWorkflow' incorrectly implements interface 'IClientWorkflow'.

Check failure on line 25 in src/implementation/Client/HTTPClient/workflow.ts

View workflow job for this annotation

GitHub Actions / test-e2e

Class 'HTTPClientWorkflow' incorrectly implements interface 'IClientWorkflow'.
private readonly client: HTTPClient;
private readonly logger: Logger;

Expand Down Expand Up @@ -65,7 +65,7 @@
}
}

async start(
async scheduleNewWorkflow(
workflowName: string,
input?: any,
instanceId?: string | undefined,
Expand Down Expand Up @@ -106,7 +106,7 @@
}
}

async raise(
async raiseEvent(
instanceId: string,
eventName: string,
eventData?: any,
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/Client/IClientWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default interface IClientWorkflow {
* Get information about a workflow instance.
* @param instanceId The unique identifier for the workflow instance.
*/

get(instanceId: string): Promise<WorkflowGetResponseType>;

/**
Expand Down
8 changes: 4 additions & 4 deletions test/unit/protocols/http/workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ describe("workflow", () => {
const workflow = new HTTPClientWorkflow(client);

it("should throw PropertyRequiredError when instanceID variable is not provided in get method", async () => {
await expect(workflow.get("")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.getWorkflowState("")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when workflowName variable is not provided in start method", async () => {
await expect(workflow.start("")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.scheduleNewWorkflow("")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when instanceID variable is not provided in _invokeMethod method", async () => {
await expect(workflow._invokeMethod("", "raise")).rejects.toThrow(PropertyRequiredError);
Expand All @@ -37,9 +37,9 @@ describe("workflow", () => {
await expect(workflow._invokeMethod(randomUUID(), "")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when instanceID variable is not provided in raise method", async () => {
await expect(workflow.raise("", "Event")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.raiseEvent("", "Event")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when eventName variable is not provided in raise method", async () => {
await expect(workflow.raise(randomUUID(), "")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.raiseEvent(randomUUID(), "")).rejects.toThrow(PropertyRequiredError);
});
});
Loading