Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ describe('formatAddressDisplay', () => {
'addressCity',
'addressState',
]);
expect(result).toBe('123 Main St,New York,NY');
expect(result).toBe('123 Main St, New York, NY');
});

it('should format address with all fields when subFields is null', () => {
const result = formatAddressDisplay(mockAddressValue, null);
expect(result).toBe('123 Main St,Apt 4B,New York,NY,10001,United States');
expect(result).toBe('123 Main St, Apt 4B, New York, NY, 10001, United States');
});

it('should format address with all fields when subFields is undefined', () => {
const result = formatAddressDisplay(mockAddressValue, undefined);
expect(result).toBe('123 Main St,Apt 4B,New York,NY,10001,United States');
expect(result).toBe('123 Main St, Apt 4B, New York, NY, 10001, United States');
});

it('should format address with all fields when subFields is empty array', () => {
const result = formatAddressDisplay(mockAddressValue, []);
expect(result).toBe('123 Main St,Apt 4B,New York,NY,10001,United States');
expect(result).toBe('123 Main St, Apt 4B, New York, NY, 10001, United States');
});

it('should handle address with some empty fields', () => {
Expand All @@ -66,7 +66,7 @@ describe('formatAddressDisplay', () => {
'addressState',
'addressPostcode',
]);
expect(result).toBe('456 Oak Ave,Boston,02101');
expect(result).toBe('456 Oak Ave, Boston, 02101');
});

it('should handle single field selection', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('joinAddressFieldValues', () => {
'addressCity',
'addressState',
]);
expect(result).toBe('123 Main St,New York,NY');
expect(result).toBe('123 Main St, New York, NY');
});

it('should filter out null and empty string values', () => {
Expand All @@ -42,7 +42,7 @@ describe('joinAddressFieldValues', () => {
'addressPostcode',
'addressCountry',
]);
expect(result).toBe('456 Oak Ave,CA,90210');
expect(result).toBe('456 Oak Ave, CA, 90210');
});

it('should handle empty subFields array', () => {
Expand All @@ -64,7 +64,7 @@ describe('joinAddressFieldValues', () => {
'addressPostcode',
'addressCountry',
]);
expect(result).toBe('123 Main St,Apt 4B,New York,NY,10001,United States');
expect(result).toBe('123 Main St, Apt 4B, New York, NY, 10001, United States');
});

it('should handle address with empty and null values', () => {
Expand Down Expand Up @@ -110,6 +110,6 @@ describe('joinAddressFieldValues', () => {
'addressState',
'addressPostcode',
]);
expect(result).toBe('123 Main St,New York,10001');
expect(result).toBe('123 Main St, New York, 10001');
});
});
2 changes: 1 addition & 1 deletion packages/twenty-front/src/utils/joinAddressFieldValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export const joinAddressFieldValues = (
return subFields
.map((subField) => fieldValue[subField])
.filter(isNonEmptyString)
.join(',');
.join(', ');
Comment on lines 9 to +12
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change only adds a space after commas in the joined display string. The linked issue (#18860) describes duplicated city/country (etc.) remaining in Address 1 after selecting a suggestion, which is a different problem (data normalization/prefill mapping) and likely won’t be resolved by changing the join separator. Either adjust the PR description/issue linkage, or add the logic that strips city/state/postcode/country from addressStreet1 when populating the structured subfields.

Copilot uses AI. Check for mistakes.
};
Loading