github
113 of 123 branches covered (91.87%)
Branch coverage included in aggregate %.
2 of 2 new or added lines in 1 file covered. (100.0%)
4 existing lines in 2 files now uncovered.809 of 817 relevant lines covered (99.02%)
13.64 hits per line
1 |
import { Person } from 'gift-exchange'; |
1✔ |
2 |
|
1✔ |
3 |
interface Props { |
1✔ |
4 |
pairs: [Person, Person][];
|
1✔ |
5 |
showGroups: boolean;
|
1✔ |
6 |
} |
1✔ |
7 |
|
1✔ |
8 |
export function Pairs({ pairs, showGroups }: Props) {
|
|
9 |
if (pairs.length < 1) { |
|
10 |
return null;
|
22✔ |
11 |
} |
22✔ |
12 |
|
22✔ |
13 |
return (
|
|
14 |
<table> |
1✔ |
15 |
<caption>Secret Santa Matches</caption> |
1✔ |
16 |
<thead> |
1✔ |
17 |
<tr> |
1✔ |
18 |
<th colSpan={showGroups ? 2 : 1}>Giver</th> |
|
19 |
<th colSpan={showGroups ? 2 : 1}>Receiver</th> |
|
20 |
</tr> |
23✔ |
21 |
{showGroups && ( |
|
UNCOV
22
|
<tr> |
× |
23 |
<th>Name</th> |
23✔ |
24 |
<th>Group</th> |
23✔ |
25 |
<th>Name</th> |
23✔ |
26 |
<th>Group</th> |
23✔ |
27 |
</tr> |
23✔ |
28 |
)} |
23✔ |
29 |
</thead> |
23✔ |
30 |
<tbody> |
23✔ |
31 |
{pairs.map(([a, b]) => ( |
|
32 |
<tr key={a.name}> |
23✔ |
33 |
<td>{a.name}</td> |
23✔ |
34 |
{showGroups && <td>{a.group}</td>} |
|
35 |
<td>{b.name}</td> |
23✔ |
36 |
{showGroups && <td>{b.group}</td>} |
|
37 |
</tr> |
23✔ |
38 |
))} |
23✔ |
39 |
</tbody> |
23✔ |
40 |
</table> |
23✔ |
41 |
); |
23✔ |
42 |
} |
23✔ |