fix bug in createUrl of apiclient and added tests

This commit is contained in:
Sebastian Sdorra
2018-07-12 08:22:27 +02:00
parent 08a8d36c5e
commit ed077f704f
2 changed files with 17 additions and 4 deletions

View File

@@ -0,0 +1,13 @@
// @flow
import { createUrl } from "./apiclient";
test("create url, should not change absolute urls", () => {
expect(createUrl("https://www.scm-manager.org")).toBe(
"https://www.scm-manager.org"
);
});
test("create url, should add prefix for api", () => {
expect(createUrl("/users")).toBe("/scm/api/rest/v2/users");
expect(createUrl("users")).toBe("/scm/api/rest/v2/users");
});