Skip to content

Commit

Permalink
fix(shared-data): remove sort from choices
Browse files Browse the repository at this point in the history
remove sort from choices

close AITH-368
  • Loading branch information
koji committed Apr 24, 2024
1 parent 9d75e1f commit b2b0b96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ describe('orderRuntimeParameterRangeOptions', () => {
expect(result).toEqual('16, 20')
})

it('should return alphabetical order when choices are number', () => {
it('should return the original order when range is not numerical range', () => {
const mockChoices: Choice[] = [
{ displayName: 'Single channel 50µL', value: 'flex_1channel_50' },
{ displayName: 'Eight Channel 50µL', value: 'flex_8channel_50' },
]
const result = orderRuntimeParameterRangeOptions(mockChoices)
expect(result).toEqual('Eight Channel 50µL, Single channel 50µL')
expect(result).toEqual('Single channel 50µL, Eight Channel 50µL')
})

it('should return empty string choices > 3', () => {
Expand Down
7 changes: 1 addition & 6 deletions shared-data/js/helpers/orderRuntimeParameterRangeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ export const isNumeric = (str: string): boolean => {
* ]
* console.log(orderRuntimeParameterRangeOptions(numChoices) // 16,20
*
* const strChoices = [
* { displayName: 'Single channel 50µL', value: 'flex_1channel_50' },
* { displayName: 'Eight Channel 50µL', value: 'flex_8channel_50' },
* ]
* console.log(orderRuntimeParameterRangeOptions(strChoices) // Eight Channel 50µL, Single channel 50µL
*/
export const orderRuntimeParameterRangeOptions = (
choices: Choice[]
Expand All @@ -41,6 +36,6 @@ export const orderRuntimeParameterRangeOptions = (
})
.join(', ')
} else {
return displayNames.sort().join(', ')
return displayNames.join(', ')
}
}

0 comments on commit b2b0b96

Please sign in to comment.