Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/production' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl committed Nov 21, 2024
2 parents 577d7f7 + 6f44268 commit b261df5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/api/entities.v2/model/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class Entity {
if (property.type === 'text' || property.type === 'markdown') {
const isTitleProperty = property instanceof CommonProperty && property.name === 'title';
if (isTitleProperty) return this.title;
return this.metadata[property.name]?.[0]?.value as string;
return (this.metadata[property.name]?.[0]?.value as string) || '';
}

throw new Error('types other than string/markdown are not implemented yet');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,18 @@ describe('ATSolveVersionConflict', () => {
},
});
});

it('should not fail if the props have no value', async () => {
const currentEntity = factory.entity('current entity', 'template', { prop1: [] });
const newEntity = factory.entity('new entity', 'template', {
prop1: [],
prop2: [{ value: 'prop2' }],
});

await expect(ATSolveVersionConflict(currentEntity, newEntity)).resolves.toMatchObject({
title: 'new entity',
metadata: { prop1: [], prop2: [{ value: 'prop2' }] },
});
});
});
});

0 comments on commit b261df5

Please sign in to comment.