mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
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:
committed by
GitHub
parent
2cd46ce8a0
commit
e1239aff92
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user