Skip to content

Commit 7d80bde

Browse files
Fix files and add tests
Signed-off-by: Adhitya Mamallan <[email protected]>
1 parent ea0f3b7 commit 7d80bde

File tree

3 files changed

+63
-9
lines changed

3 files changed

+63
-9
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { render, screen } from '@/test-utils/rtl';
2+
3+
import WorkflowHistoryDetailsRowJson from '../workflow-history-details-row-json';
4+
5+
describe(WorkflowHistoryDetailsRowJson.name, () => {
6+
it('renders the stringified JSON value', () => {
7+
render(
8+
<WorkflowHistoryDetailsRowJson
9+
value={{ key: 'value', nested: { number: 123 } }}
10+
isNegative={false}
11+
label="test-label"
12+
domain="test-domain"
13+
cluster="test-cluster"
14+
workflowId="test-workflow-id"
15+
runId="test-run-id"
16+
/>
17+
);
18+
19+
expect(
20+
screen.getByText('{"key":"value","nested":{"number":123}}')
21+
).toBeInTheDocument();
22+
});
23+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { render, screen } from '@/test-utils/rtl';
2+
3+
import WorkflowHistoryDetailsRowTooltipJson from '../workflow-history-details-row-tooltip-json';
4+
5+
jest.mock(
6+
'@/views/workflow-history/workflow-history-event-details-json/workflow-history-event-details-json',
7+
() =>
8+
jest.fn(({ entryValue, isNegative }) => (
9+
<div data-testid="event-details-json">
10+
Event Details Json: {JSON.stringify(entryValue)}
11+
{isNegative && ' (negative)'}
12+
</div>
13+
))
14+
);
15+
16+
describe(WorkflowHistoryDetailsRowTooltipJson.name, () => {
17+
it('renders the label and passes value to WorkflowHistoryEventDetailsJson', () => {
18+
render(
19+
<WorkflowHistoryDetailsRowTooltipJson
20+
value={{ key: 'value', nested: { number: 123 } }}
21+
label="test-label"
22+
isNegative={false}
23+
domain="test-domain"
24+
cluster="test-cluster"
25+
workflowId="test-workflow-id"
26+
runId="test-run-id"
27+
/>
28+
);
29+
30+
expect(screen.getByText('test-label')).toBeInTheDocument();
31+
expect(screen.getByTestId('event-details-json')).toBeInTheDocument();
32+
expect(
33+
screen.getByText(
34+
/Event Details Json: \{"key":"value","nested":\{"number":123\}\}/
35+
)
36+
).toBeInTheDocument();
37+
});
38+
});

src/views/workflow-history-v2/workflow-history-event-group/workflow-history-event-group.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,13 @@ export default function WorkflowHistoryEventGroup({
8585
? [
8686
getSummaryTabContentEntry({
8787
groupId: eventGroup.firstEventId ?? 'unknown',
88-
summaryDetails: summaryDetailsEntries.flatMap(
89-
([_eventId, { eventDetails }]) => eventDetails
90-
),
88+
summaryDetails: groupSummaryDetails,
9189
}),
9290
]
9391
: []),
9492
...groupDetailsEntries,
9593
],
96-
[
97-
eventGroup.firstEventId,
98-
groupDetailsEntries,
99-
summaryDetailsEntries,
100-
groupSummaryDetails.length,
101-
]
94+
[eventGroup.firstEventId, groupDetailsEntries, groupSummaryDetails]
10295
);
10396

10497
return (

0 commit comments

Comments
 (0)