core-app-api: fix handling of empty paths

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: blam <ben@blam.sh>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-08-24 15:01:30 +02:00
parent 98984826af
commit baa2ec822d
3 changed files with 4 additions and 4 deletions
@@ -518,7 +518,7 @@ describe('Integration Test', () => {
</Provider>,
),
).toThrow(
'Parameter :thing is duplicated in path /test/:thing/some/:thing',
'Parameter :thing is duplicated in path test/:thing/some/:thing',
);
});
expect(errorLogs).toEqual([
@@ -82,7 +82,7 @@ function resolveTargetRef(
// Find the path that our target route is bound to
const resolvedPath = routePaths.get(targetRef);
if (!resolvedPath) {
if (resolvedPath === undefined) {
return [undefined, ''];
}
@@ -154,7 +154,7 @@ function resolveBasePath(
// what parameters those are.
const diffPaths = refDiffList.slice(0, -1).map(ref => {
const path = routePaths.get(ref);
if (!path) {
if (path === undefined) {
throw new Error(`No path for ${ref}`);
}
if (path.includes(':')) {
@@ -41,7 +41,7 @@ export function validateRouteParameters(
let fullPath = '';
while (currentRouteRef) {
const path = routePaths.get(currentRouteRef);
if (!path) {
if (path === undefined) {
throw new Error(`No path for ${currentRouteRef}`);
}
fullPath = joinPaths(path, fullPath);