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

mendersoftware / gui / 951400782

pending completion
951400782

Pull #3900

gitlab-ci

web-flow
chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #3900: chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

4446 of 6414 branches covered (69.32%)

8342 of 10084 relevant lines covered (82.73%)

186.0 hits per line

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

86.21
/src/js/components/dashboard/widgets/deployments.js
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import React, { useEffect } from 'react';
15
import { useDispatch } from 'react-redux';
16

17
import { makeStyles } from 'tss-react/mui';
18

19
import isUUID from 'validator/lib/isUUID';
20

21
import { getDeviceById } from '../../../actions/deviceActions';
22
import { DEPLOYMENT_STATES } from '../../../constants/deploymentConstants';
23
import Time from '../../common/time';
24
import { DeploymentDeviceGroup, DeploymentProgress } from '../../deployments/deploymentitem';
25
import DeploymentStats from '../../deployments/deploymentstatus';
26
import { DeploymentStatusNotification } from '../../deployments/progressChart';
27

28
const maxWidth = 500;
6✔
29

30
const useStyles = makeStyles()(theme => ({
358✔
31
  base: {
32
    alignItems: 'center',
33
    backgroundColor: theme.palette.grey[400],
34
    borderRadius: theme.spacing(),
35
    columnGap: theme.spacing(2),
36
    display: 'grid',
37
    gridTemplateColumns: '200px 1fr',
38
    maxWidth,
39
    padding: theme.spacing(),
40
    '> div:last-child': {
41
      width: '100%'
42
    }
43
  },
44
  [DEPLOYMENT_STATES.finished]: { background: theme.palette.background.paper, borderRadius: theme.spacing(0.5), padding: theme.spacing(0.5) },
45
  wrapper: { display: 'flex', flexDirection: 'column', maxWidth, '> time': { alignSelf: 'flex-end', marginRight: 6 } }
46
}));
47

48
const KeyInfo = ({ deployment, devicesById, idAttribute }) => (
6✔
49
  <div>
3,000✔
50
    <div>{deployment.artifact_name}</div>
51
    <DeploymentDeviceGroup deployment={deployment} devicesById={devicesById} idAttribute={idAttribute} wrappingClass="" />
52
  </div>
53
);
54

55
const deploymentStateComponentMap = {
6✔
56
  [DEPLOYMENT_STATES.pending]: () => <DeploymentStatusNotification status="queued" />,
1,014✔
57
  [DEPLOYMENT_STATES.inprogress]: ({ deployment }) => <DeploymentProgress deployment={deployment} minimal />,
1,000✔
58
  [DEPLOYMENT_STATES.finished]: ({ classes, deployment }) => (
59
    <div className={classes.finished}>
986✔
60
      <DeploymentStats deployment={deployment} />
61
    </div>
62
  )
63
};
64

65
const BaseDeploymentWidget = ({ deployment, devicesById, idAttribute, onClick, state }) => {
6✔
66
  const { classes } = useStyles();
3,000✔
67
  const dispatch = useDispatch();
3,000✔
68

69
  useEffect(() => {
3,000✔
70
    if (isUUID(deployment.name) && !devicesById[deployment.name]) {
51!
71
      dispatch(getDeviceById(deployment.name));
×
72
    }
73
  }, [deployment.name]);
74

75
  const Component = deploymentStateComponentMap[state];
3,000✔
76
  const onWidgetClick = () => onClick({ route: 'deployments', id: deployment.id, tab: state === DEPLOYMENT_STATES.finished ? state : undefined, open: true });
3,000!
77

78
  return (
3,000✔
79
    <div className={`clickable ${classes.base}`} onClick={onWidgetClick}>
80
      <KeyInfo deployment={deployment} devicesById={devicesById} idAttribute={idAttribute} />
81
      <Component classes={classes} deployment={deployment} />
82
    </div>
83
  );
84
};
85

86
export const BaseDeploymentsWidget = ({ deployments, ...props }) =>
6✔
87
  deployments.map(deployment => <BaseDeploymentWidget deployment={deployment} key={deployment.id} {...props} />);
2,014✔
88

89
export const CompletedDeployments = ({ deployments, ...props }) => {
6✔
90
  const { classes } = useStyles();
515✔
91
  return deployments.map(deployment => (
515✔
92
    <div className={classes.wrapper} key={deployment.id}>
986✔
93
      <Time className="muted slightly-smaller" value={deployment.finished} />
94
      <BaseDeploymentWidget deployment={deployment} {...props} />
95
    </div>
96
  ));
97
};
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

© 2025 Coveralls, Inc