From 45332b320204989861e18f6307f18ec5a6fb8317 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Tue, 18 Aug 2020 23:15:07 -0400 Subject: [PATCH] Added test spec for helpers/util/uri.js --- helpers/utils/__tests__/uri.spec.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 helpers/utils/__tests__/uri.spec.js 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") + }) +})