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

mendersoftware / mender-server / 1593965839

18 Dec 2024 10:58AM UTC coverage: 73.514% (+0.7%) from 72.829%
1593965839

Pull #253

gitlab-ci

mineralsfree
chore(gui): aligned tests with edit billing profile

Ticket: MEN-7466
Changelog: None

Signed-off-by: Mikita Pilinka <mikita.pilinka@northern.tech>
Pull Request #253: MEN-7466-feat: updated billing section in My Organization settings

4257 of 6185 branches covered (68.83%)

Branch coverage included in aggregate %.

53 of 87 new or added lines in 11 files covered. (60.92%)

43 existing lines in 11 files now uncovered.

40083 of 54130 relevant lines covered (74.05%)

22.98 hits per line

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

87.5
/frontend/src/js/store/usersSlice/selectors.ts
1
// Copyright 2023 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
// @ts-nocheck
15
import { DEVICE_ONLINE_CUTOFF, defaultIdAttribute } from '@northern.tech/store/constants';
16
import { isDarkMode } from '@northern.tech/store/utils';
17
import { createSelector } from '@reduxjs/toolkit';
18

19
import { READ_STATES, twoFAStates } from './constants';
20

21
export const getRolesById = state => state.users.rolesById;
1,729✔
22
export const getTooltipsById = state => state.users.tooltips.byId;
2,562✔
23
export const getGlobalSettings = state => state.users.globalSettings;
8,984✔
24

25
const getCurrentUserId = state => state.users.currentUser;
1,801✔
26
export const getUsersById = state => state.users.byId;
1,813✔
27
export const getCurrentUser = createSelector([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
129✔
28
export const getUserSettings = state => state.users.userSettings;
18,531✔
29

30
export const getIsDarkMode = createSelector([getUserSettings], ({ mode }) => isDarkMode(mode));
129✔
31

32
export const getShowHelptips = createSelector([getTooltipsById], tooltips =>
129✔
33
  Object.values(tooltips).reduce((accu, { readState }) => accu || readState === READ_STATES.unread, false)
5!
34
);
35

36
export const getTooltipsState = createSelector([getTooltipsById, getUserSettings], (byId, { tooltips = {} }) =>
129✔
37
  Object.entries(byId).reduce(
65✔
38
    (accu, [id, value]) => {
UNCOV
39
      accu[id] = { ...accu[id], ...value };
×
40
      return accu;
×
41
    },
42
    { ...tooltips }
43
  )
44
);
45

46
export const getHas2FA = createSelector(
129✔
47
  [getCurrentUser],
48
  currentUser => currentUser.hasOwnProperty('tfa_status') && currentUser.tfa_status === twoFAStates.enabled
6✔
49
);
50

51
export const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
129✔
52

53
export const getOfflineThresholdSettings = createSelector([getGlobalSettings], ({ offlineThreshold }) => ({
129✔
54
  interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
50✔
55
  intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
50✔
56
}));
57

58
export const getRolesList = createSelector([getRolesById], rolesById => Object.entries(rolesById).map(([value, role]) => ({ value, ...role })));
129✔
59

60
export const getCurrentSession = state => state.users.currentSession;
8,690✔
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