|
| 1 | +/* |
| 2 | +Copyright 2023 The Dapr Authors |
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +you may not use this file except in compliance with the License. |
| 5 | +You may obtain a copy of the License at |
| 6 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +Unless required by applicable law or agreed to in writing, software |
| 8 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +See the License for the specific language governing permissions and |
| 11 | +limitations under the License. |
| 12 | +*/ |
| 13 | + |
| 14 | +import HTTPClient from "../../../src/implementation/Client/HTTPClient/HTTPClient"; |
| 15 | +import { PropertyRequiredError } from "../../../src/errors/PropertyRequiredError"; |
| 16 | +import HTTPClientWorkflow from "../../../src/implementation/Client/HTTPClient/workflow"; |
| 17 | +import { randomUUID } from "crypto"; |
| 18 | + |
| 19 | +describe("workflow", () => { |
| 20 | + const client = new HTTPClient({ |
| 21 | + daprHost: "", |
| 22 | + daprPort: "", |
| 23 | + communicationProtocol: 0, |
| 24 | + }); |
| 25 | + const workflow = new HTTPClientWorkflow(client); |
| 26 | + |
| 27 | + it("should throw PropertyRequiredError when instanceID variable is not provided in get method", async () => { |
| 28 | + await expect(workflow.get("")).rejects.toThrow(PropertyRequiredError); |
| 29 | + }); |
| 30 | + it("should throw PropertyRequiredError when workflowName variable is not provided in start method", async () => { |
| 31 | + await expect(workflow.start("")).rejects.toThrow(PropertyRequiredError); |
| 32 | + }); |
| 33 | + it("should throw PropertyRequiredError when instanceID variable is not provided in _invokeMethod method", async () => { |
| 34 | + await expect(workflow._invokeMethod("", "raise")).rejects.toThrow(PropertyRequiredError); |
| 35 | + }); |
| 36 | + it("should throw PropertyRequiredError when method variable is not provided in _invokeMethod method", async () => { |
| 37 | + await expect(workflow._invokeMethod(randomUUID(), "")).rejects.toThrow(PropertyRequiredError); |
| 38 | + }); |
| 39 | + it("should throw PropertyRequiredError when instanceID variable is not provided in raise method", async () => { |
| 40 | + await expect(workflow.raise("", "Event")).rejects.toThrow(PropertyRequiredError); |
| 41 | + }); |
| 42 | + it("should throw PropertyRequiredError when eventName variable is not provided in raise method", async () => { |
| 43 | + await expect(workflow.raise(randomUUID(), "")).rejects.toThrow(PropertyRequiredError); |
| 44 | + }); |
| 45 | +}); |
0 commit comments