Skip to content

Commit

Permalink
Fix abstract query page param
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen authored and thostetler committed Jul 17, 2024
1 parent d6e420b commit 24a0ae0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const defaultRequestConfig: AxiosRequestConfig = {
serialize: (params) =>
qs.stringify(params, {
indices: false,
arrayFormat: 'comma',
arrayFormat: 'repeat',
format: 'RFC1738',
sort: (a, b) => a - b,
skipNulls: true,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ClassicForm/__tests__/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('Classic Form Query Handling', () => {
])(`getBibstems(%s) -> %s`, (bibstems, expected) => expect(getBibstems(bibstems)).toBe(expected));

test('getSearchQuery handles empty input', () => {
expect(getSearchQuery({} as IRawClassicFormState)).toBe('q=%2A%3A%2A&sort=score+desc%2Cdate+desc&p=1');
expect(getSearchQuery({} as IRawClassicFormState)).toBe('q=%2A%3A%2A&sort=score+desc&sort=date+desc&p=1');
});

test('getSearchQuery properly generates search query', () => {
Expand All @@ -135,6 +135,6 @@ describe('Classic Form Query Handling', () => {
expect(result.get('q')).toBe(
`collection:(astronomy physics) pubdate:[2020-12 TO 2022-01] author:("Smith, A" "Jones, B" ="Jones, Bob") object:(IRAS HIP) property:(refereed article) title:("Black Hole" -"Milky Way" -star) abs:("Event Horizon" Singularity) bibstem:(PhRvL) -bibstem:(Apj)`,
);
expect(result.getAll('sort')).toStrictEqual(['score desc,date desc']);
expect(result.getAll('sort')).toStrictEqual(['score desc', 'date desc']);
});
});
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export const makeSearchParams = (params: SafeSearchUrlParams, options: { omit?:
export const stringifySearchParams = (params: Record<string, unknown>, options?: qs.IStringifyOptions) =>
qs.stringify(params, {
indices: false,
arrayFormat: 'comma',
arrayFormat: 'repeat',
format: 'RFC1738',
sort: (a, b) => a - b,
skipNulls: true,
Expand Down

0 comments on commit 24a0ae0

Please sign in to comment.