Skip to content

Commit 2dea5d0

Browse files
committed
test(launch): keep map regression focused
The test name and assertions already carry the relaunch scenario. Repeating the same behavior in source and test comments adds noise without documenting another constraint. Signed-off-by: 1fanwang <1fannnw@gmail.com>
1 parent 2a71d4f commit 2dea5d0

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎packages/oss-console/src/components/Launch/LaunchForm/MapInput.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,12 @@ function parseMappedTypeValue(value?: InputValue): MapInputItem[] {
122122
const mapObj = JSON.parse(value.toString());
123123
if (typeof mapObj === 'object') {
124124
return Object.keys(mapObj).map((key, index) => {
125-
// Object values (e.g. Map[str, struct] on relaunch) must be JSON-stringified for the text field.
126125
const itemValue = mapObj[key];
127-
return getNewMapItem(index, key, typeof itemValue === 'object' ? JSON.stringify(itemValue) : itemValue);
126+
return getNewMapItem(
127+
index,
128+
key,
129+
typeof itemValue === 'object' ? JSON.stringify(itemValue) : itemValue,
130+
);
128131
});
129132
}
130133
} catch (e) {

‎packages/oss-console/src/components/Launch/LaunchForm/test/MapInput.test.tsx‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ const renderMap = (value: string) =>
2828

2929
describe('MapInput', () => {
3030
it('renders an object map value as JSON (not "[object Object]") when relaunching', () => {
31-
// A map whose values are themselves objects -- the shape a prior execution produces when
32-
// relaunching (e.g. Map[str, struct]). Before the fix this binds an object straight into the
33-
// value text field, which coerces to "[object Object]" (and produced render errors).
3431
const { container } = renderMap('{"foo":{"nested":"bar"}}');
3532

3633
const keyField = container.querySelector('.keyControl input') as HTMLInputElement;

0 commit comments

Comments
 (0)