Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions spec/urlHelpers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ describe('Testing Default UrlHelpers: getUrlFromState', () => {
expect(params.has(testRequestState.filterName)).toBe(false);
expect(params.has(testRequestState.filterValue)).toBe(false);
});

test('Should encode filterName and filterValue as part of the path', () => {
const urlString = getUrlFromState(testRequestState as RequestConfigs, {
baseUrl: 'https://www.example.com/a/random/path',
});
const url = new URL(urlString);
const paths = url.pathname.split('/');

expect(paths.indexOf(testRequestState.filterName)).not.toBe(-1);
expect(paths.indexOf(testRequestState.filterValue)).not.toBe(-1);
});
});

describe('Testing Default UrlHelpers: getStateFromUrl', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/useBrowseResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Testing Hook: useBrowseResults', () => {

const url = getUrlFromState(
{ filterValue: '123', filters, resultsPerPage, page },
{ baseUrl: 'https://example.com/browse/' },
{ baseUrl: 'https://example.com/browse/123' },
);
mockLocation.href = url;

Expand Down
7 changes: 1 addition & 6 deletions src/utils/urlHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,5 @@ export function getUrlFromState(
}
});

let groupPath = '';
if (state.filterValue) {
groupPath = `/${state.filterName}/${state.filterValue}`;
}

return `${baseUrl}${groupPath}?${params.toString()}`;
return `${baseUrl}?${params.toString()}`;
}