1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { joinUrls } from "services/api/url-builder";
7 describe("UrlBuilder", () => {
8 it("should join urls properly 1", () => {
9 expect(joinUrls('http://localhost:3000', '/main')).toEqual('http://localhost:3000/main');
11 it("should join urls properly 2", () => {
12 expect(joinUrls('http://localhost:3000/', '/main')).toEqual('http://localhost:3000/main');
14 it("should join urls properly 3", () => {
15 expect(joinUrls('http://localhost:3000//', '/main')).toEqual('http://localhost:3000/main');
17 it("should join urls properly 4", () => {
18 expect(joinUrls('http://localhost:3000', '//main')).toEqual('http://localhost:3000/main');
20 it("should join urls properly 5", () => {
21 expect(joinUrls('http://localhost:3000///', 'main')).toEqual('http://localhost:3000/main');
23 it("should join urls properly 6", () => {
24 expect(joinUrls('http://localhost:3000///', '//main')).toEqual('http://localhost:3000/main');
26 it("should join urls properly 7", () => {
27 expect(joinUrls(undefined, '//main')).toEqual('/main');
29 it("should join urls properly 8", () => {
30 expect(joinUrls(undefined, 'main')).toEqual('/main');
32 it("should join urls properly 9", () => {
33 expect(joinUrls('http://localhost:3000///', undefined)).toEqual('http://localhost:3000');