implement react-query for edge-cases (#1711)

When initially implementing react-query, we focussed on core features. This pull request now replaces the remaining apiClient usages in ui-components and ui-webapp with react-query hooks.
This commit is contained in:
Konstantin Schaper
2021-06-28 13:19:03 +02:00
committed by GitHub
parent 2cd46ce8a0
commit e1239aff92
50 changed files with 1101 additions and 1116 deletions

View File

@@ -60,4 +60,40 @@ describe("requireLink tests", () => {
};
expect(() => requiredLink(object, "spaceship")).toThrowError();
});
it("should return sub-link if it exists", () => {
const object = {
_links: {
spaceship: [
{
name: "one",
href: "/v2/one"
},
{
name: "two",
href: "/v2/two"
}
]
}
};
expect(requiredLink(object, "spaceship", "one")).toBe("/v2/one");
});
it("should throw error, if sub-link does not exist in link array", () => {
const object = {
_links: {
spaceship: [
{
name: "one",
href: "/v2/one"
},
{
name: "two",
href: "/v2/two"
}
]
}
};
expect(() => requiredLink(object, "spaceship", "three")).toThrowError();
});
});