Skip to content

Commit

Permalink
style(file-router): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodin committed Dec 9, 2024
1 parent 9c67785 commit af07789
Showing 1 changed file with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ describe('RouterBuilder', () => {
]);
reset = mockDocumentBaseURI('https://example.com/foo');
// @ts-expect-error Fake just enough so tests pass
globalThis.window = { history: { replaceState: () => {} }, location: '', addEventListener: () => {} };
globalThis.window = {
history: {
replaceState: () => {},
},
location: '',
addEventListener: () => {},
};
// @ts-expect-error Fake just enough so tests pass
globalThis.document.defaultView = globalThis.window;
});
Expand Down Expand Up @@ -834,22 +840,6 @@ describe('RouterBuilder', () => {
});

describe('issues', () => {
function removeUndefined(obj: unknown): unknown {
if (Array.isArray(obj)) {
return obj.map((v) => (typeof v === 'object' ? removeUndefined(v) : v));
}

if (obj != null && typeof obj === 'object') {
return Object.fromEntries(
Object.entries(obj)
.filter(([, value]) => value !== undefined)
.map(([key, value]) => [key, removeUndefined(value)]),
);
}

return obj;
}

it('#2954', () => {
const { routes } = new RouterConfigurationBuilder()
.withFileRoutes([
Expand Down

0 comments on commit af07789

Please sign in to comment.