• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DLR-SC / ESID / 15845945232

24 Jun 2025 08:55AM UTC coverage: 51.517% (+0.5%) from 51.024%
15845945232

Pull #414

github

fifth-island
fix(tests): resolve test failures in CI

This commit fixes a series of cascading test failures that occurred after introducing the semantic search feature.

- Wraps test components in ArticleDataProvider to provide necessary context.

- Removes a duplicate data-testid that caused an ambiguous element error.
Pull Request #414: feat: Implement basic article search feature

418 of 539 branches covered (77.55%)

Branch coverage included in aggregate %.

353 of 582 new or added lines in 15 files covered. (60.65%)

102 existing lines in 6 files now uncovered.

4115 of 8260 relevant lines covered (49.82%)

4.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.13
/src/components/ScenarioComponents/CardsComponents/MainCard/MainCard.tsx
1
// SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR)
2
// SPDX-License-Identifier: Apache-2.0
3

4
import React, {Dispatch} from 'react';
5
import Box from '@mui/material/Box';
1✔
6
import useTheme from '@mui/material/styles/useTheme';
1✔
7
import CardTitle from './CardTitle';
1✔
8
import CardTooltip from './CardTooltip';
1✔
9
import CardRows from './CardRows';
1✔
10
import {Localization} from 'types/localization';
11
import {hexToRGB} from 'util/util';
1✔
12

13
interface MainCardProps {
14
  /** A unique identifier for the card. */
15
  id: string;
16

17
  /** The title of the card. */
18
  label: string;
19

20
  /** The color of the card. */
21
  color: string;
22

23
  /** A dictionary of compartment values associated with the card. */
24
  compartmentValues: Record<string, number | null> | null;
25

26
  /** A dictionary of reference values used for calculating the rate. This determines whether the values have increased, decreased, or remained the same. */
27
  referenceValues: Record<string, number> | null;
28

29
  /** A boolean indicating whether the compartments are expanded. */
30
  compartmentsExpanded: boolean;
31

32
  /** The compartment that is currently selected. */
33
  selectedCompartmentId: string | null;
34

35
  /** A boolean indicating whether the user is hovering over the card. */
36
  hover: boolean;
37

38
  /** A function to set the hover state of the card. */
39
  setHover: Dispatch<boolean>;
40

41
  /** A boolean indicating whether the scenario is selected. */
42
  isSelected: boolean;
43

44
  /** A function to set the selected scenario. */
45
  setSelected: Dispatch<{id: string; state: boolean}>;
46

47
  /** A boolean indicating whether the scenario is active. */
48
  isActive: boolean;
49

50
  /** A function to set the active scenario. */
51
  setActive: Dispatch<{id: string; state: boolean}>;
52

53
  /** A function to hide/remove the card. */
54
  hide: Dispatch<string>;
55

56
  /** The minimum number of compartment rows. */
57
  minCompartmentsRows: number;
58

59
  /** The maximum number of compartment rows. */
60
  maxCompartmentsRows: number;
61

62
  /** An object containing localization information (translation & number formattation).*/
63
  localization?: Localization;
64

65
  /** Boolean to determine if the arrow is displayed */
66
  arrow?: boolean;
67
}
68

69
/**
70
 * This component renders a card for either the case data or the scenario cards. Each card contains a title,
71
 * a list of compartment values, and change rates relative to the simulation start. Additionally, a tooltip is used to set whether the card is active or not.
72
 * Furthermore, the card is clickable, and if clicked, it will become the selected scenario.
73
 */
74
function MainCard({
27✔
75
  id,
27✔
76
  label,
27✔
77
  hover,
27✔
78
  compartmentValues,
27✔
79
  referenceValues,
27✔
80
  setHover,
27✔
81
  compartmentsExpanded,
27✔
82
  selectedCompartmentId,
27✔
83
  color,
27✔
84
  isSelected,
27✔
85
  isActive,
27✔
86
  minCompartmentsRows,
27✔
87
  setSelected,
27✔
88
  setActive,
27✔
89
  hide,
27✔
90
  maxCompartmentsRows,
27✔
91
  localization = {
27✔
92
    formatNumber: (value: number) => value.toString(),
27✔
93
    customLang: 'global',
27✔
94
    overrides: {},
27✔
95
  },
27✔
96
  arrow = true,
27✔
97
}: MainCardProps) {
27✔
98
  const theme = useTheme();
27✔
99
  return (
27✔
100
    <Box
27✔
101
      id={`main-card-external-container-${id}`}
27✔
102
      sx={{
27✔
103
        display: 'flex',
27✔
104
        flexDirection: 'column',
27✔
105
        backgroundColor: ((hover || isSelected) && isActive) || hover ? hexToRGB(color, 0.4) : null,
27✔
106
        zIndex: 3,
27✔
107
        boxShadow: ((hover || isSelected) && isActive) || hover ? `0 0 0 6px ${hexToRGB(color, 0.4)}` : null,
27✔
108
        borderRadius: ((hover || isSelected) && isActive) || hover ? 1 : null,
27✔
109
        borderColor: color,
27✔
110
      }}
27✔
111
      onMouseEnter={() => setHover(true)}
27✔
112
      onMouseLeave={() => setHover(false)}
27✔
113
      onClick={() => {
27✔
UNCOV
114
        if (isActive) {
×
UNCOV
115
          setSelected({id, state: true});
×
UNCOV
116
        } else {
×
UNCOV
117
          setActive({id, state: true});
×
UNCOV
118
          setSelected({id, state: true});
×
UNCOV
119
        }
×
UNCOV
120
      }}
×
121
    >
122
      <Box
27✔
123
        id={`main-card-title&compartments-container-${id}`}
27✔
124
        className='hide-scrollbar'
27✔
125
        sx={{
27✔
126
          maxHeight: compartmentsExpanded
27✔
127
            ? maxCompartmentsRows > 5
27!
UNCOV
128
              ? `${(340 / 6) * maxCompartmentsRows}px`
×
129
              : `${(480 / 6) * maxCompartmentsRows}px`
27!
UNCOV
130
            : 'auto',
×
131
          paddingBottom: '9px',
27✔
132
          boxSizing: 'border-box',
27✔
133
          width: '200px',
27✔
134
          bgcolor: theme.palette.background.paper,
27✔
135
          zIndex: 0,
27✔
136
          display: 'flex',
27✔
137
          flexDirection: 'column',
27✔
138
          border: 2,
27✔
139
          borderRadius: 1,
27✔
140
          borderColor: color,
27✔
141
          transition: 'transform 0.5s',
27✔
142
          transformStyle: 'preserve-3d',
27✔
143
          transform: isActive ? 'none' : 'rotateY(180deg)',
27✔
144
        }}
27✔
145
      >
146
        <Box
27✔
147
          id={`main-card-title-container-${id}`}
27✔
148
          sx={{
27✔
149
            display: 'flex',
27✔
150
            height: '65px',
27✔
151
            alignItems: 'self-end',
27✔
152
            justifyContent: 'left',
27✔
153
            width: 'full',
27✔
154
            transform: isActive ? 'none' : 'rotateY(180deg)',
27✔
155
          }}
27✔
156
        >
157
          <CardTitle label={label} color={color} />
27✔
158
        </Box>
27✔
159
        <CardRows
27✔
160
          compartmentValues={compartmentValues}
27✔
161
          referenceValues={referenceValues}
27✔
162
          isFlipped={isActive}
27✔
163
          compartmentExpanded={compartmentsExpanded}
27✔
164
          selectedCompartmentId={selectedCompartmentId}
27✔
165
          color={color}
27✔
166
          minCompartmentsRows={minCompartmentsRows}
27✔
167
          maxCompartmentsRows={maxCompartmentsRows}
27✔
168
          localization={localization}
27✔
169
          arrow={arrow}
27✔
170
        />
27✔
171
      </Box>
27✔
172
      <CardTooltip
27✔
173
        hover={hover}
27✔
174
        color={color}
27✔
175
        id={id}
27✔
176
        isActive={isActive}
27✔
177
        setActive={setActive}
27✔
178
        hide={hide}
27✔
179
        setSelected={setSelected}
27✔
180
        localization={localization}
27✔
181
      />
27✔
182
    </Box>
27✔
183
  );
184
}
27✔
185

186
export default MainCard;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc