-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(getSuggestions): allow nested arrays to be returned (#331)
* fix(getSuggestions): allow nested arrays to be returned this is useful, since it allows getAlgoliaHits to be used top-level, but also within a single source, without having to take the first element of the array manually * Update packages/autocomplete-core/src/getAutocompleteSetters.ts Co-authored-by: François Chalifour <[email protected]> * inline logic in test * better wording for test * refactor test * revert public api change * idk * fix import in test * change type in test * remove comment * fix tests based on rebase * fix type * remove multi * remove more Co-authored-by: François Chalifour <[email protected]>
- Loading branch information
1 parent
d39f4cf
commit 753c8ca
Showing
6 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { flatten } from '../utils'; | ||
|
||
describe('flatten', () => { | ||
it('does not split strings', () => { | ||
expect(flatten(['value', 'value'])).toEqual(['value', 'value']); | ||
}); | ||
|
||
it('spreads arrays', () => { | ||
expect(flatten(['value', ['value']])).toEqual(['value', 'value']); | ||
}); | ||
|
||
it('ignores empty arrays', () => { | ||
expect(flatten([[], 'value', 'value'])).toEqual(['value', 'value']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters