v1
- by gabrirf 11/2/202200
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const data = [{
    "stage": "AT_CALLCENTER",
    "content": "Hello",
  },
  {
    "stage": "AT_CALLCENTER",
    "content": "Bye",
  },
  {
    "stage": "AT_SITE",
    "content": "Good",
  },
  {
    "stage": "AT_SITE",
    "content": "Morning",
  }
]
delete caserun single casemove downdrag and drop case


ready



const result = data.reduce((val, item) => ({ ...val,
  [`${item.stage}`]: [...(val[item.stage] || []), item.content]
}), {});
delete caserun single casemove upmove downdrag and drop case


ready



const stages = [...new Set(data.map(i => i.stage))]
const result = Object.fromEntries(
  stages.map(s => [s, data.filter(i => i.stage === s).map(i => i.content)])
)
delete caserun single casemove upmove downdrag and drop case


ready



const result = {};

for (const { stage, content } of data) {
  result[stage] ??= [];
  result[stage].push(content);
}
delete caserun single casemove upmove downdrag and drop case


ready



const result = data.reduce((val, item) => {
	val[item.stage] = [...(val[item.stage] || []), item.content]
	return val;
}, {});
delete caserun single casemove upmove downdrag and drop case


ready



const result = data.reduce((val, item) => {
	val[item.stage] ??= [];
 	val[item.stage].push(item.content);
  return val;
}, {});
delete caserun single casemove updrag and drop case


ready



const stages = [...new Set(data.map(i => i.stage))]
const result = data.reduce((val, item) => {
 	val[item.stage].push(item.content);
  	return val;
}, Object.fromEntries(stages.map(s => [s, []])));
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN