Skip to content

Commit 5683b33

Browse files
authored
fix(shared-data): remove sort from choices (#14996)
* fix(shared-data): remove sort from choices
1 parent 9d75e1f commit 5683b33

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

shared-data/js/helpers/__tests__/orderRuntimeParameterRangeOptions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ describe('orderRuntimeParameterRangeOptions', () => {
2929
expect(result).toEqual('16, 20')
3030
})
3131

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

4141
it('should return empty string choices > 3', () => {

shared-data/js/helpers/orderRuntimeParameterRangeOptions.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ export const isNumeric = (str: string): boolean => {
1717
* ]
1818
* console.log(orderRuntimeParameterRangeOptions(numChoices) // 16,20
1919
*
20-
* const strChoices = [
21-
* { displayName: 'Single channel 50µL', value: 'flex_1channel_50' },
22-
* { displayName: 'Eight Channel 50µL', value: 'flex_8channel_50' },
23-
* ]
24-
* console.log(orderRuntimeParameterRangeOptions(strChoices) // Eight Channel 50µL, Single channel 50µL
2520
*/
2621
export const orderRuntimeParameterRangeOptions = (
2722
choices: Choice[]
@@ -41,6 +36,6 @@ export const orderRuntimeParameterRangeOptions = (
4136
})
4237
.join(', ')
4338
} else {
44-
return displayNames.sort().join(', ')
39+
return displayNames.join(', ')
4540
}
4641
}

0 commit comments

Comments
 (0)