Added test spec for helpers/util/uri.js

This commit is contained in:
Andrew Bastin
2020-08-18 23:15:07 -04:00
parent cb0258cb58
commit 45332b3202

View File

@@ -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")
})
})