Skip to content

Commit bfc9017

Browse files
Copilothotlong
andcommitted
fix: update RecordDetailEdit test to match findOne call signature without undefined 3rd arg
DetailView now only passes 3rd arg to findOne when $expand params exist, matching the original 2-arg call signature when no expand is needed. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 19f2c0c commit bfc9017

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/console/src/__tests__/RecordDetailEdit.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('RecordDetailView — recordId handling', () => {
8989
});
9090

9191
// findOne should be called with the FULL URL recordId (no stripping)
92-
expect(ds.findOne).toHaveBeenCalledWith('contact', 'contact-1772350253615-4', undefined);
92+
expect(ds.findOne).toHaveBeenCalledWith('contact', 'contact-1772350253615-4');
9393

9494
// Click the Edit button
9595
const editButton = await screen.findByRole('button', { name: /edit/i });
@@ -115,7 +115,7 @@ describe('RecordDetailView — recordId handling', () => {
115115
});
116116

117117
// findOne should be called with the original ID unchanged
118-
expect(ds.findOne).toHaveBeenCalledWith('contact', 'plain-id-12345', undefined);
118+
expect(ds.findOne).toHaveBeenCalledWith('contact', 'plain-id-12345');
119119

120120
const editButton = await screen.findByRole('button', { name: /edit/i });
121121
await userEvent.click(editButton);

packages/plugin-detail/src/DetailSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const DetailSection: React.FC<DetailSectionProps> = ({
8484
const resolvedType = field.type || objectDefField?.type;
8585
const enrichedField: Record<string, any> = { ...field };
8686
if (objectDefField) {
87-
if (!enrichedField.type && objectDefField.type) enrichedField.type = objectDefField.type;
87+
if (!field.type && objectDefField.type) enrichedField.type = objectDefField.type;
8888
if (objectDefField.options && !enrichedField.options) enrichedField.options = objectDefField.options;
8989
if (objectDefField.currency && !enrichedField.currency) enrichedField.currency = objectDefField.currency;
9090
if (objectDefField.precision !== undefined && enrichedField.precision === undefined) enrichedField.precision = objectDefField.precision;

0 commit comments

Comments
 (0)