2b4894015fc70f68c0b22975c35da94aa7d44c1f
[arvados-workbench2.git] / src / services / api / url-builder.test.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { OrderBuilder } from "./order-builder";
6 import { joinUrls } from "~/services/api/url-builder";
7
8 describe("UrlBuilder", () => {
9     it("should join urls properly 1", () => {
10         expect(joinUrls('http://localhost:3000', '/main')).toEqual('http://localhost:3000/main');
11     });
12     it("should join urls properly 2", () => {
13         expect(joinUrls('http://localhost:3000/', '/main')).toEqual('http://localhost:3000/main');
14     });
15     it("should join urls properly 3", () => {
16         expect(joinUrls('http://localhost:3000//', '/main')).toEqual('http://localhost:3000/main');
17     });
18     it("should join urls properly 4", () => {
19         expect(joinUrls('http://localhost:3000', '//main')).toEqual('http://localhost:3000/main');
20     });
21     it("should join urls properly 5", () => {
22         expect(joinUrls('http://localhost:3000///', 'main')).toEqual('http://localhost:3000/main');
23     });
24     it("should join urls properly 6", () => {
25         expect(joinUrls('http://localhost:3000///', '//main')).toEqual('http://localhost:3000/main');
26     });
27     it("should join urls properly 7", () => {
28         expect(joinUrls(undefined, '//main')).toEqual('/main');
29     });
30     it("should join urls properly 8", () => {
31         expect(joinUrls(undefined, 'main')).toEqual('/main');
32     });
33     it("should join urls properly 9", () => {
34         expect(joinUrls('http://localhost:3000///', undefined)).toEqual('http://localhost:3000');
35     });
36 });