Skip to content

Commit

Permalink
fix(composer): update property string length limit to 2048
Browse files Browse the repository at this point in the history
  • Loading branch information
sheilaXu authored and mumanity committed Jan 30, 2024
1 parent 9ce8bff commit a3cb800
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/scene-composer/src/common/entityModelConstants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { KnownComponentType } from '../interfaces';

export const MAX_PROPERTY_STRING_LENGTH = 256;
export const MAX_PROPERTY_STRING_LENGTH = 2048;

// Scene Nodes
const SCENE_COMPONENT_TYPE_ID_PREFIX = 'com.amazon.iottwinmaker.3d';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { componentTypeToId } from '../../common/entityModelConstants';
import { MAX_PROPERTY_STRING_LENGTH, componentTypeToId } from '../../common/entityModelConstants';
import { KnownComponentType } from '../../interfaces';
import { Component } from '../../models/SceneModels';

Expand Down Expand Up @@ -65,7 +65,7 @@ describe('createOverlayEntityComponent', () => {
});

it('should return expected overlay component with data rows having long content', () => {
const longContent = new Array(60).fill('0123456789').join('');
const longContent = new Array(600).fill('0123456789').join('');
const result = createOverlayEntityComponent({
type: KnownComponentType.DataOverlay,
subType: Component.DataOverlaySubType.TextAnnotation,
Expand All @@ -91,27 +91,33 @@ describe('createOverlayEntityComponent', () => {
stringValue: Component.DataOverlayRowType.Markdown,
},
content: {
stringValue:
'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345',
stringValue: expect.stringContaining('0123456789'),
},
content_1: {
stringValue:
'6789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901',
stringValue: expect.stringContaining('0123456789'),
},
content_2: {
stringValue:
'2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789',
stringValue: expect.stringContaining('0123456789'),
},
},
},
],
},
},
});
expect(result.properties?.dataRows.value?.listValue?.[0].mapValue?.content.stringValue?.length).toEqual(
MAX_PROPERTY_STRING_LENGTH,
);
expect(result.properties?.dataRows.value?.listValue?.[0].mapValue?.content_1.stringValue?.length).toEqual(
MAX_PROPERTY_STRING_LENGTH,
);
expect(result.properties?.dataRows.value?.listValue?.[0].mapValue?.content_2.stringValue?.length).toEqual(
6000 - MAX_PROPERTY_STRING_LENGTH * 2,
);
});

it('should return expected overlay component with data rows having long content and split to no more than 10 parts', () => {
const longContent = new Array(1000).fill('0123456789').join('');
const longContent = new Array(3000).fill('0123456789').join('');
const result = createOverlayEntityComponent({
type: KnownComponentType.DataOverlay,
subType: Component.DataOverlaySubType.TextAnnotation,
Expand Down

0 comments on commit a3cb800

Please sign in to comment.