PromucFlow_constructor/app/client/packages/utils/src/validateApiPath/validateApiPath.test.ts

18 lines
519 B
TypeScript
Raw Normal View History

import { validateApiPath } from "./validateApiPath";
describe("validateApiPath", () => {
it("should return the path if it starts with 'https://'", () => {
const validPath = "https://example.com";
expect(validateApiPath(validPath)).toBe(validPath);
});
it("should throw an error if the path does not start with 'https://'", () => {
const invalidPath = "example.com";
expect(() => validateApiPath(invalidPath)).toThrow(
"The example.com path must start with 'https://'.",
);
});
});