uri.spec.js 609 B

123456789101112131415161718192021
  1. import { parseUrlAndPath } from "../uri"
  2. describe("parseUrlAndPath", () => {
  3. test("has url and path fields", () => {
  4. const result = parseUrlAndPath("https://hoppscotch.io/")
  5. expect(result).toHaveProperty("url")
  6. expect(result).toHaveProperty("path")
  7. })
  8. test("parses out URL correctly", () => {
  9. const result = parseUrlAndPath("https://hoppscotch.io/test/page")
  10. expect(result.url).toBe("https://hoppscotch.io")
  11. })
  12. test("parses out Path correctly", () => {
  13. const result = parseUrlAndPath("https://hoppscotch.io/test/page")
  14. expect(result.path).toBe("/test/page")
  15. })
  16. })