Skip to content

Commit

Permalink
extractEntityTypeOptionFromRow: remove lowerCaseValue arg
Browse files Browse the repository at this point in the history
- It was always true
  • Loading branch information
labkey-alan committed Nov 4, 2024
1 parent dfd247d commit d1d5186
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@ describe('extractEntityTypeOptionFromRow', () => {
LSID: { value: 'ABC123' },
};

test('lowerCaseValue = true', () => {
test('return value as expected', () => {
const options = extractEntityTypeOptionFromRow(ROW);
expect(options.label).toBe(NAME);
expect(options.lsid).toBe('ABC123');
expect(options.rowId).toBe(1);
expect(options.value).toBe(NAME.toLowerCase());
expect(options.query).toBe(NAME);
});

test('lowerCaseValue = false', () => {
const options = extractEntityTypeOptionFromRow(ROW, false);
expect(options.label).toBe(NAME);
expect(options.lsid).toBe('ABC123');
expect(options.rowId).toBe(1);
expect(options.value).toBe(NAME);
expect(options.query).toBe(NAME);
});
});

describe('getChosenParentData', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ function resolveEntityParentTypeFromIds(
// export for jest
export function extractEntityTypeOptionFromRow(
row: Row,
lowerCaseValue = true,
entityDataType?: EntityDataType,
requiredParentTypes?: string[]
): IEntityTypeOption {
Expand All @@ -447,7 +446,7 @@ export function extractEntityTypeOptionFromRow(
label: name,
lsid: caseInsensitive(row, 'LSID').value,
rowId: caseInsensitive(row, 'RowId').value,
value: lowerCaseValue ? name.toLowerCase() : name, // we match values on lower case because (at least) when parsed from an id they are lower case
value: name.toLowerCase(), // we match values on lower case because (at least) when parsed from an id they are lower case
query: name,
entityDataType,
isFromSharedContainer: caseInsensitive(row, 'Folder/Path')?.value === SHARED_CONTAINER_PATH,
Expand Down Expand Up @@ -551,7 +550,7 @@ export async function getEntityTypeOptions(

const options: IEntityTypeOption[] = result.rows
.map(row => ({
...extractEntityTypeOptionFromRow(row, true, entityDataType, requiredParentTypes),
...extractEntityTypeOptionFromRow(row, entityDataType, requiredParentTypes),
schema: instanceSchemaName, // e.g. "samples" or "dataclasses"
}))
.sort(naturalSortByProperty('label'));
Expand Down

0 comments on commit d1d5186

Please sign in to comment.