Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Added test spec for helpers/util/uri.js

Andrew Bastin45332b320204
diff --git a/helpers/utils/__tests__/uri.spec.js b/helpers/utils/__tests__/uri.spec.js
new file mode 100644
index 000000000..1b1dcf5a0
--- /dev/null
+++ b/helpers/utils/__tests__/uri.spec.js
@@ -0,0 +1,21 @@
+import { parseUrlAndPath } from "../uri"
+
+describe("parseUrlAndPath", () => {
+ test("has url and path fields", () => {
+ const result = parseUrlAndPath("https://hoppscotch.io/")
+
+ expect(result).toHaveProperty("url")
+ expect(result).toHaveProperty("path")
+ })
+
+ test("parses out URL correctly", () => {
+ const result = parseUrlAndPath("https://hoppscotch.io/test/page")
+
+ expect(result.url).toBe("https://hoppscotch.io")
+ })
+ test("parses out Path correctly", () => {
+ const result = parseUrlAndPath("https://hoppscotch.io/test/page")
+
+ expect(result.path).toBe("/test/page")
+ })
+})