From 7ab98be4adb70c50808bfd5cc0f7305f39627f4d Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 27 Oct 2020 17:58:01 +0000 Subject: [PATCH] Add tests for baseUrl with trailing slash --- tests/util.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/util.test.js b/tests/util.test.js index 3729f27..d79779d 100644 --- a/tests/util.test.js +++ b/tests/util.test.js @@ -22,6 +22,13 @@ describe("getApiUrl", () => { expect(getApiUrl("/foo/bar").href).toBe( "http://example.com/owntracks/foo/bar" ); + + config.api.baseUrl = "http://example.com/owntracks/"; + expect(getApiUrl("foo").href).toBe("http://example.com/owntracks/foo"); + expect(getApiUrl("/foo").href).toBe("http://example.com/owntracks/foo"); + expect(getApiUrl("/foo/bar").href).toBe( + "http://example.com/owntracks/foo/bar" + ); }); });