@northern.tech/store 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.mts +95 -0
- package/dist/actions.d.ts +95 -0
- package/dist/actions.js +1746 -0
- package/dist/actions.js.map +1 -0
- package/dist/actions.mjs +21 -0
- package/dist/actions.mjs.map +1 -0
- package/dist/api/general-api.d.mts +21 -0
- package/dist/api/general-api.d.ts +21 -0
- package/dist/api/general-api.js +1002 -0
- package/dist/api/general-api.js.map +1 -0
- package/dist/api/general-api.mjs +18 -0
- package/dist/api/general-api.mjs.map +1 -0
- package/dist/api/types/Address.ts +6 -0
- package/dist/api/types/AddressUpdate.ts +12 -0
- package/dist/api/types/AuthSet.ts +37 -0
- package/{api/types/AuthSet.ts → dist/api/types/AuthSetIot_manager.ts} +2 -2
- package/dist/api/types/BillingProfile.ts +37 -0
- package/dist/api/types/BillingProfileUpdate.ts +37 -0
- package/{api → dist/api}/types/BinaryDeltaLimits.ts +6 -0
- package/{api → dist/api}/types/BoundingBox.ts +1 -3
- package/dist/api/types/Deployment.ts +45 -0
- package/{api → dist/api}/types/DeploymentAggregation.ts +1 -3
- package/{api → dist/api}/types/DeploymentAggregationItem.ts +1 -3
- package/{api → dist/api}/types/DeploymentAggregationTerm.ts +1 -2
- package/{api → dist/api}/types/DeploymentAggregationTerms.ts +1 -3
- package/{api → dist/api}/types/DeploymentAttributeProjection.ts +1 -2
- package/{api → dist/api}/types/DeploymentDeployments.ts +4 -5
- package/{api → dist/api}/types/DeploymentFilterTerm.ts +1 -3
- package/dist/api/types/DeploymentPhaseDeployments.ts +23 -0
- package/{api → dist/api}/types/DeploymentSearchTerms.ts +1 -3
- package/{api → dist/api}/types/DeploymentSortTerm.ts +1 -3
- package/dist/api/types/DeploymentStatisticsDeployments.ts +15 -0
- package/dist/api/types/DeploymentStatusStatisticsDeployments.ts +54 -0
- package/dist/api/types/Device.ts +20 -0
- package/{api → dist/api}/types/DeviceAggregation.ts +1 -3
- package/{api → dist/api}/types/DeviceAggregationItem.ts +1 -3
- package/{api → dist/api}/types/DeviceAggregationTerm.ts +1 -2
- package/{api → dist/api}/types/DeviceAggregationTerms.ts +1 -3
- package/{api → dist/api}/types/DeviceAttribute.ts +1 -2
- package/{api → dist/api}/types/DeviceAttributeProjection.ts +1 -2
- package/{api/types/Device.ts → dist/api/types/DeviceDeployments.ts} +1 -1
- package/{api → dist/api}/types/DeviceFilterAttribute.ts +1 -2
- package/{api → dist/api}/types/DeviceFilterTerm.ts +1 -3
- package/{api → dist/api}/types/DeviceSearchTerms.ts +1 -3
- package/{api → dist/api}/types/DeviceSortTerm.ts +1 -3
- package/{api → dist/api}/types/Error.ts +1 -1
- package/{api/types/FilterInventory.ts → dist/api/types/Filter.ts} +3 -4
- package/{api/types/Filter.ts → dist/api/types/FilterInventory.ts} +1 -1
- package/dist/api/types/FilterPredicate.ts +48 -0
- package/{api/types/FilterPredicate.ts → dist/api/types/FilterPredicateInventory.ts} +3 -3
- package/{api → dist/api}/types/GeoBoundingBox.ts +1 -3
- package/{api → dist/api}/types/GeoBoundingBoxFilter.ts +1 -2
- package/{api → dist/api}/types/GeoDistance.ts +1 -3
- package/{api → dist/api}/types/GeoDistanceFilter.ts +1 -3
- package/{api → dist/api}/types/GeoPoint.ts +1 -2
- package/{api → dist/api}/types/Integration.ts +6 -0
- package/{api → dist/api}/types/MenderTypes.ts +41 -11
- package/{api → dist/api}/types/NewDeploymentV2.ts +3 -0
- package/{api → dist/api}/types/NewTenant.ts +16 -8
- package/{api → dist/api}/types/Object.ts +3 -0
- package/{api → dist/api}/types/PreAuthSet.ts +1 -1
- package/{api → dist/api}/types/Settings.ts +3 -3
- package/{api → dist/api}/types/Status.ts +5 -4
- package/{api → dist/api}/types/StatusTenantadm.ts +1 -3
- package/dist/api/types/Tenant.ts +21 -0
- package/{api → dist/api}/types/TenantTenantadm.ts +16 -0
- package/dist/api/types/UpdateChildTenant.ts +17 -0
- package/{api → dist/api}/types/UpdateDeployments.ts +1 -1
- package/{api → dist/api}/types/UpgradeCompleteRequest.ts +2 -0
- package/{api → dist/api}/types/UserWithTenantInfo.ts +7 -3
- package/dist/api/users-api.d.mts +16 -0
- package/dist/api/users-api.d.ts +16 -0
- package/dist/api/users-api.js +1026 -0
- package/dist/api/users-api.js.map +1 -0
- package/dist/api/users-api.mjs +15 -0
- package/dist/api/users-api.mjs.map +1 -0
- package/dist/appSlice/constants.d.mts +210 -0
- package/dist/appSlice/constants.d.ts +210 -0
- package/dist/appSlice/constants.js +221 -0
- package/dist/appSlice/constants.js.map +1 -0
- package/dist/appSlice/constants.mjs +42 -0
- package/dist/appSlice/constants.mjs.map +1 -0
- package/dist/appSlice/index.d.mts +1557 -0
- package/dist/appSlice/index.d.ts +1557 -0
- package/dist/appSlice/index.js +1067 -0
- package/dist/appSlice/index.js.map +1 -0
- package/dist/appSlice/index.mjs +21 -0
- package/dist/appSlice/index.mjs.map +1 -0
- package/dist/appSlice/selectors.d.mts +91 -0
- package/dist/appSlice/selectors.d.ts +91 -0
- package/dist/appSlice/selectors.js +90 -0
- package/dist/appSlice/selectors.js.map +1 -0
- package/dist/appSlice/selectors.mjs +20 -0
- package/dist/appSlice/selectors.mjs.map +1 -0
- package/dist/appSlice/thunks.d.mts +46 -0
- package/dist/appSlice/thunks.d.ts +46 -0
- package/dist/appSlice/thunks.js +5655 -0
- package/dist/appSlice/thunks.js.map +1 -0
- package/dist/appSlice/thunks.mjs +45 -0
- package/dist/appSlice/thunks.mjs.map +1 -0
- package/dist/auth.d.mts +17 -0
- package/dist/auth.d.ts +17 -0
- package/dist/auth.js +985 -0
- package/dist/auth.js.map +1 -0
- package/dist/auth.mjs +23 -0
- package/dist/auth.mjs.map +1 -0
- package/dist/chunk-6667TCAJ.mjs +135 -0
- package/dist/chunk-6667TCAJ.mjs.map +1 -0
- package/{releasesSlice/index.ts → dist/chunk-7E7KJHY3.mjs} +33 -32
- package/dist/chunk-7E7KJHY3.mjs.map +1 -0
- package/{usersSlice/index.ts → dist/chunk-BJSH2G7W.mjs} +39 -58
- package/dist/chunk-BJSH2G7W.mjs.map +1 -0
- package/dist/chunk-BOSBROA3.mjs +168 -0
- package/dist/chunk-BOSBROA3.mjs.map +1 -0
- package/dist/chunk-BRHSKNFC.mjs +70 -0
- package/dist/chunk-BRHSKNFC.mjs.map +1 -0
- package/dist/chunk-C2YZYTJ6.mjs +37 -0
- package/dist/chunk-C2YZYTJ6.mjs.map +1 -0
- package/dist/chunk-DZBVTSIX.mjs +55 -0
- package/dist/chunk-DZBVTSIX.mjs.map +1 -0
- package/{appSlice/index.ts → dist/chunk-F37LUTBX.mjs} +58 -68
- package/dist/chunk-F37LUTBX.mjs.map +1 -0
- package/dist/chunk-G32LAKW4.mjs +239 -0
- package/dist/chunk-G32LAKW4.mjs.map +1 -0
- package/dist/chunk-G3I53JGW.mjs +243 -0
- package/dist/chunk-G3I53JGW.mjs.map +1 -0
- package/dist/chunk-G4FGNSV3.mjs +13 -0
- package/dist/chunk-G4FGNSV3.mjs.map +1 -0
- package/dist/chunk-G7LATUT6.mjs +110 -0
- package/dist/chunk-G7LATUT6.mjs.map +1 -0
- package/dist/chunk-H2PQQMRY.mjs +7 -0
- package/dist/chunk-H2PQQMRY.mjs.map +1 -0
- package/{devicesSlice/index.ts → dist/chunk-HRWZJQMH.mjs} +57 -77
- package/dist/chunk-HRWZJQMH.mjs.map +1 -0
- package/dist/chunk-HVHZG2H4.mjs +56 -0
- package/dist/chunk-HVHZG2H4.mjs.map +1 -0
- package/dist/chunk-HXPYJ6QN.mjs +75 -0
- package/dist/chunk-HXPYJ6QN.mjs.map +1 -0
- package/dist/chunk-IPPIKGIB.mjs +35 -0
- package/dist/chunk-IPPIKGIB.mjs.map +1 -0
- package/dist/chunk-IU4OXOPA.mjs +46 -0
- package/dist/chunk-IU4OXOPA.mjs.map +1 -0
- package/dist/chunk-IVSYYXTC.mjs +36 -0
- package/dist/chunk-IVSYYXTC.mjs.map +1 -0
- package/{onboardingSlice/index.ts → dist/chunk-M4U5R7A4.mjs} +19 -22
- package/dist/chunk-M4U5R7A4.mjs.map +1 -0
- package/dist/chunk-N7G6QK2E.mjs +414 -0
- package/dist/chunk-N7G6QK2E.mjs.map +1 -0
- package/dist/chunk-O6O3D52B.mjs +39 -0
- package/dist/chunk-O6O3D52B.mjs.map +1 -0
- package/dist/chunk-QBKCUIWO.mjs +7 -0
- package/dist/chunk-QBKCUIWO.mjs.map +1 -0
- package/dist/chunk-R2GBNXLV.mjs +57 -0
- package/dist/chunk-R2GBNXLV.mjs.map +1 -0
- package/dist/chunk-RH6ONMG7.mjs +65 -0
- package/dist/chunk-RH6ONMG7.mjs.map +1 -0
- package/dist/chunk-RQOE5OOT.mjs +284 -0
- package/dist/chunk-RQOE5OOT.mjs.map +1 -0
- package/dist/chunk-TD45YTYK.mjs +108 -0
- package/dist/chunk-TD45YTYK.mjs.map +1 -0
- package/dist/chunk-V32GTKOS.mjs +1 -0
- package/dist/chunk-V32GTKOS.mjs.map +1 -0
- package/dist/chunk-XWBD7VOK.mjs +93 -0
- package/dist/chunk-XWBD7VOK.mjs.map +1 -0
- package/dist/chunk-XYVPYFSM.mjs +106 -0
- package/dist/chunk-XYVPYFSM.mjs.map +1 -0
- package/dist/chunk-YNVSU3AA.mjs +2977 -0
- package/dist/chunk-YNVSU3AA.mjs.map +1 -0
- package/dist/chunk-ZIYGEXSJ.mjs +145 -0
- package/dist/chunk-ZIYGEXSJ.mjs.map +1 -0
- package/dist/chunk-ZNST5R6O.mjs +658 -0
- package/dist/chunk-ZNST5R6O.mjs.map +1 -0
- package/dist/commonConstants.d.mts +248 -0
- package/dist/commonConstants.d.ts +248 -0
- package/dist/commonConstants.js +303 -0
- package/dist/commonConstants.js.map +1 -0
- package/dist/commonConstants.mjs +40 -0
- package/dist/commonConstants.mjs.map +1 -0
- package/dist/commonSelectors.d.mts +896 -0
- package/dist/commonSelectors.d.ts +896 -0
- package/dist/commonSelectors.js +1482 -0
- package/dist/commonSelectors.js.map +1 -0
- package/dist/commonSelectors.mjs +54 -0
- package/dist/commonSelectors.mjs.map +1 -0
- package/dist/constants.d.mts +12 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +1246 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +219 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/deploymentsSlice/constants.d.mts +142 -0
- package/dist/deploymentsSlice/constants.d.ts +142 -0
- package/dist/deploymentsSlice/constants.js +969 -0
- package/dist/deploymentsSlice/constants.js.map +1 -0
- package/dist/deploymentsSlice/constants.mjs +42 -0
- package/dist/deploymentsSlice/constants.mjs.map +1 -0
- package/dist/deploymentsSlice/index.d.mts +2373 -0
- package/dist/deploymentsSlice/index.d.ts +2373 -0
- package/dist/deploymentsSlice/index.js +1053 -0
- package/dist/deploymentsSlice/index.js.map +1 -0
- package/dist/deploymentsSlice/index.mjs +21 -0
- package/dist/deploymentsSlice/index.mjs.map +1 -0
- package/dist/deploymentsSlice/selectors.d.mts +59 -0
- package/dist/deploymentsSlice/selectors.d.ts +59 -0
- package/dist/deploymentsSlice/selectors.js +969 -0
- package/dist/deploymentsSlice/selectors.js.map +1 -0
- package/dist/deploymentsSlice/selectors.mjs +25 -0
- package/dist/deploymentsSlice/selectors.mjs.map +1 -0
- package/dist/deploymentsSlice/thunks.d.mts +202 -0
- package/dist/deploymentsSlice/thunks.d.ts +202 -0
- package/dist/deploymentsSlice/thunks.js +5671 -0
- package/dist/deploymentsSlice/thunks.js.map +1 -0
- package/dist/deploymentsSlice/thunks.mjs +63 -0
- package/dist/deploymentsSlice/thunks.mjs.map +1 -0
- package/dist/devicesSlice/constants.d.mts +44 -0
- package/dist/devicesSlice/constants.d.ts +44 -0
- package/dist/devicesSlice/constants.js +969 -0
- package/dist/devicesSlice/constants.js.map +1 -0
- package/dist/devicesSlice/constants.mjs +40 -0
- package/dist/devicesSlice/constants.mjs.map +1 -0
- package/dist/devicesSlice/index.d.mts +2223 -0
- package/dist/devicesSlice/index.d.ts +2223 -0
- package/dist/devicesSlice/index.js +1109 -0
- package/dist/devicesSlice/index.js.map +1 -0
- package/dist/devicesSlice/index.mjs +21 -0
- package/dist/devicesSlice/index.mjs.map +1 -0
- package/dist/devicesSlice/selectors.d.mts +261 -0
- package/dist/devicesSlice/selectors.d.ts +261 -0
- package/dist/devicesSlice/selectors.js +1084 -0
- package/dist/devicesSlice/selectors.js.map +1 -0
- package/dist/devicesSlice/selectors.mjs +53 -0
- package/dist/devicesSlice/selectors.mjs.map +1 -0
- package/dist/devicesSlice/thunks.d.mts +742 -0
- package/dist/devicesSlice/thunks.d.ts +742 -0
- package/dist/devicesSlice/thunks.js +5743 -0
- package/dist/devicesSlice/thunks.js.map +1 -0
- package/dist/devicesSlice/thunks.mjs +135 -0
- package/dist/devicesSlice/thunks.mjs.map +1 -0
- package/dist/monitorSlice/constants.d.mts +6 -0
- package/dist/monitorSlice/constants.d.ts +6 -0
- package/dist/monitorSlice/constants.js +919 -0
- package/dist/monitorSlice/constants.js.map +1 -0
- package/dist/monitorSlice/constants.mjs +14 -0
- package/dist/monitorSlice/constants.mjs.map +1 -0
- package/dist/monitorSlice/index.d.mts +291 -0
- package/dist/monitorSlice/index.d.ts +291 -0
- package/dist/monitorSlice/index.js +971 -0
- package/dist/monitorSlice/index.js.map +1 -0
- package/dist/monitorSlice/index.mjs +21 -0
- package/dist/monitorSlice/index.mjs.map +1 -0
- package/dist/monitorSlice/selectors.d.mts +3 -0
- package/dist/monitorSlice/selectors.d.ts +3 -0
- package/dist/monitorSlice/selectors.js +31 -0
- package/dist/monitorSlice/selectors.js.map +1 -0
- package/dist/monitorSlice/selectors.mjs +8 -0
- package/dist/monitorSlice/selectors.mjs.map +1 -0
- package/dist/monitorSlice/thunks.d.mts +71 -0
- package/dist/monitorSlice/thunks.d.ts +71 -0
- package/dist/monitorSlice/thunks.js +2531 -0
- package/dist/monitorSlice/thunks.js.map +1 -0
- package/dist/monitorSlice/thunks.mjs +44 -0
- package/dist/monitorSlice/thunks.mjs.map +1 -0
- package/dist/onboardingSlice/constants.d.mts +23 -0
- package/dist/onboardingSlice/constants.d.ts +23 -0
- package/dist/onboardingSlice/constants.js +71 -0
- package/dist/onboardingSlice/constants.js.map +1 -0
- package/dist/onboardingSlice/constants.mjs +10 -0
- package/dist/onboardingSlice/constants.mjs.map +1 -0
- package/dist/onboardingSlice/index.d.mts +237 -0
- package/dist/onboardingSlice/index.d.ts +237 -0
- package/dist/onboardingSlice/index.js +94 -0
- package/dist/onboardingSlice/index.js.map +1 -0
- package/dist/onboardingSlice/index.mjs +16 -0
- package/dist/onboardingSlice/index.mjs.map +1 -0
- package/dist/onboardingSlice/selectors.d.mts +3 -0
- package/dist/onboardingSlice/selectors.d.ts +3 -0
- package/dist/onboardingSlice/selectors.js +31 -0
- package/dist/onboardingSlice/selectors.js.map +1 -0
- package/dist/onboardingSlice/selectors.mjs +8 -0
- package/dist/onboardingSlice/selectors.mjs.map +1 -0
- package/dist/onboardingSlice/thunks.d.mts +172 -0
- package/dist/onboardingSlice/thunks.d.ts +172 -0
- package/dist/onboardingSlice/thunks.js +5661 -0
- package/dist/onboardingSlice/thunks.js.map +1 -0
- package/dist/onboardingSlice/thunks.mjs +51 -0
- package/dist/onboardingSlice/thunks.mjs.map +1 -0
- package/dist/organizationSlice/constants.d.mts +134 -0
- package/dist/organizationSlice/constants.d.ts +134 -0
- package/dist/organizationSlice/constants.js +978 -0
- package/dist/organizationSlice/constants.js.map +1 -0
- package/dist/organizationSlice/constants.mjs +34 -0
- package/dist/organizationSlice/constants.mjs.map +1 -0
- package/dist/organizationSlice/index.d.mts +1097 -0
- package/dist/organizationSlice/index.d.ts +1097 -0
- package/dist/organizationSlice/index.js +1015 -0
- package/dist/organizationSlice/index.js.map +1 -0
- package/dist/organizationSlice/index.mjs +21 -0
- package/dist/organizationSlice/index.mjs.map +1 -0
- package/dist/organizationSlice/selectors.d.mts +134 -0
- package/dist/organizationSlice/selectors.d.ts +134 -0
- package/dist/organizationSlice/selectors.js +977 -0
- package/dist/organizationSlice/selectors.js.map +1 -0
- package/dist/organizationSlice/selectors.mjs +39 -0
- package/dist/organizationSlice/selectors.mjs.map +1 -0
- package/dist/organizationSlice/thunks.d.mts +502 -0
- package/dist/organizationSlice/thunks.d.ts +502 -0
- package/dist/organizationSlice/thunks.js +5709 -0
- package/dist/organizationSlice/thunks.js.map +1 -0
- package/dist/organizationSlice/thunks.mjs +101 -0
- package/dist/organizationSlice/thunks.mjs.map +1 -0
- package/dist/releasesSlice/constants.d.mts +14 -0
- package/dist/releasesSlice/constants.d.ts +14 -0
- package/dist/releasesSlice/constants.js +40 -0
- package/dist/releasesSlice/constants.js.map +1 -0
- package/dist/releasesSlice/constants.mjs +14 -0
- package/dist/releasesSlice/constants.mjs.map +1 -0
- package/dist/releasesSlice/index.d.mts +483 -0
- package/dist/releasesSlice/index.d.ts +483 -0
- package/dist/releasesSlice/index.js +1034 -0
- package/dist/releasesSlice/index.js.map +1 -0
- package/dist/releasesSlice/index.mjs +21 -0
- package/dist/releasesSlice/index.mjs.map +1 -0
- package/dist/releasesSlice/selectors.d.mts +92 -0
- package/dist/releasesSlice/selectors.d.ts +92 -0
- package/dist/releasesSlice/selectors.js +967 -0
- package/dist/releasesSlice/selectors.js.map +1 -0
- package/dist/releasesSlice/selectors.mjs +28 -0
- package/dist/releasesSlice/selectors.mjs.map +1 -0
- package/dist/releasesSlice/thunks.d.mts +276 -0
- package/dist/releasesSlice/thunks.d.ts +276 -0
- package/dist/releasesSlice/thunks.js +2843 -0
- package/dist/releasesSlice/thunks.js.map +1 -0
- package/dist/releasesSlice/thunks.mjs +66 -0
- package/dist/releasesSlice/thunks.mjs.map +1 -0
- package/dist/selectors.d.mts +10 -0
- package/dist/selectors.d.ts +10 -0
- package/dist/selectors.js +1636 -0
- package/dist/selectors.js.map +1 -0
- package/dist/selectors.mjs +207 -0
- package/dist/selectors.mjs.map +1 -0
- package/dist/store.d.mts +2306 -0
- package/dist/store.d.ts +2306 -0
- package/dist/store.js +1877 -0
- package/dist/store.js.map +1 -0
- package/dist/store.mjs +32 -0
- package/dist/store.mjs.map +1 -0
- package/dist/storehooks.d.mts +4 -0
- package/dist/storehooks.d.ts +4 -0
- package/dist/storehooks.js +5844 -0
- package/dist/storehooks.js.map +1 -0
- package/dist/storehooks.mjs +265 -0
- package/dist/storehooks.mjs.map +1 -0
- package/dist/thunks.d.mts +12 -0
- package/dist/thunks.d.ts +12 -0
- package/dist/thunks.js +5973 -0
- package/dist/thunks.js.map +1 -0
- package/dist/thunks.mjs +363 -0
- package/dist/thunks.mjs.map +1 -0
- package/dist/usersSlice/constants.d.mts +635 -0
- package/dist/usersSlice/constants.d.ts +635 -0
- package/dist/usersSlice/constants.js +967 -0
- package/dist/usersSlice/constants.js.map +1 -0
- package/dist/usersSlice/constants.mjs +43 -0
- package/dist/usersSlice/constants.mjs.map +1 -0
- package/dist/usersSlice/index.d.mts +6993 -0
- package/dist/usersSlice/index.d.ts +6993 -0
- package/dist/usersSlice/index.js +1054 -0
- package/dist/usersSlice/index.js.map +1 -0
- package/dist/usersSlice/index.mjs +21 -0
- package/dist/usersSlice/index.mjs.map +1 -0
- package/dist/usersSlice/selectors.d.mts +209 -0
- package/dist/usersSlice/selectors.d.ts +209 -0
- package/dist/usersSlice/selectors.js +997 -0
- package/dist/usersSlice/selectors.js.map +1 -0
- package/dist/usersSlice/selectors.mjs +38 -0
- package/dist/usersSlice/selectors.mjs.map +1 -0
- package/dist/usersSlice/thunks.d.mts +881 -0
- package/dist/usersSlice/thunks.d.ts +881 -0
- package/dist/usersSlice/thunks.js +5717 -0
- package/dist/usersSlice/thunks.js.map +1 -0
- package/dist/usersSlice/thunks.mjs +109 -0
- package/dist/usersSlice/thunks.mjs.map +1 -0
- package/dist/utils.d.mts +60 -0
- package/dist/utils.d.ts +60 -0
- package/dist/utils.js +1160 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +49 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +22 -5
- package/.eslintrc.cjs +0 -9
- package/.prettierignore +0 -1
- package/CHANGELOG.md +0 -19
- package/actions.ts +0 -32
- package/api/general-api.test.ts +0 -51
- package/api/general-api.ts +0 -60
- package/api/types/Deployment.ts +0 -95
- package/api/types/DeviceDeployments.ts +0 -31
- package/api/types/FilterPredicateInventory.ts +0 -76
- package/api/types/Tenant.ts +0 -38
- package/api/users-api.ts +0 -34
- package/appSlice/constants.ts +0 -166
- package/appSlice/reducer.test.ts +0 -97
- package/appSlice/selectors.ts +0 -33
- package/appSlice/thunks.test.ts +0 -118
- package/appSlice/thunks.ts +0 -148
- package/auth.test.ts +0 -36
- package/auth.ts +0 -82
- package/commonConstants.tsx +0 -252
- package/commonSelectors.ts +0 -255
- package/constants.ts +0 -22
- package/deploymentsSlice/constants.ts +0 -175
- package/deploymentsSlice/index.ts +0 -145
- package/deploymentsSlice/reducer.test.ts +0 -108
- package/deploymentsSlice/selectors.ts +0 -58
- package/deploymentsSlice/thunks.test.ts +0 -425
- package/deploymentsSlice/thunks.ts +0 -382
- package/devicesSlice/constants.ts +0 -56
- package/devicesSlice/reducer.test.ts +0 -194
- package/devicesSlice/selectors.ts +0 -127
- package/devicesSlice/thunks.test.tsx +0 -1245
- package/devicesSlice/thunks.tsx +0 -1098
- package/monitorSlice/constants.ts +0 -17
- package/monitorSlice/index.ts +0 -65
- package/monitorSlice/reducer.test.ts +0 -79
- package/monitorSlice/selectors.ts +0 -15
- package/monitorSlice/thunks.test.ts +0 -112
- package/monitorSlice/thunks.ts +0 -101
- package/onboardingSlice/constants.ts +0 -53
- package/onboardingSlice/reducer.test.ts +0 -45
- package/onboardingSlice/selectors.ts +0 -15
- package/onboardingSlice/thunks.test.ts +0 -235
- package/onboardingSlice/thunks.ts +0 -142
- package/organizationSlice/constants.ts +0 -82
- package/organizationSlice/index.ts +0 -111
- package/organizationSlice/reducer.test.ts +0 -78
- package/organizationSlice/selectors.ts +0 -45
- package/organizationSlice/thunks.test.ts +0 -619
- package/organizationSlice/thunks.ts +0 -383
- package/releasesSlice/constants.ts +0 -18
- package/releasesSlice/reducer.test.ts +0 -78
- package/releasesSlice/selectors.ts +0 -33
- package/releasesSlice/thunks.test.ts +0 -389
- package/releasesSlice/thunks.ts +0 -379
- package/selectors.ts +0 -22
- package/store.ts +0 -89
- package/storehooks.test.tsx +0 -386
- package/storehooks.ts +0 -250
- package/thunks.ts +0 -21
- package/tsconfig.json +0 -11
- package/tsup.config.ts +0 -11
- package/usersSlice/constants.ts +0 -374
- package/usersSlice/reducer.test.ts +0 -141
- package/usersSlice/selectors.ts +0 -60
- package/usersSlice/thunks.test.ts +0 -660
- package/usersSlice/thunks.ts +0 -773
- package/utils.test.ts +0 -187
- package/utils.ts +0 -249
- /package/{api → dist/api}/types/AWSCredentials.ts +0 -0
- /package/{api → dist/api}/types/Actor.ts +0 -0
- /package/{api → dist/api}/types/Addon.ts +0 -0
- /package/{api → dist/api}/types/AddonTenantadm.ts +0 -0
- /package/{api → dist/api}/types/Alert.ts +0 -0
- /package/{api → dist/api}/types/AlertDetails.ts +0 -0
- /package/{api → dist/api}/types/AlertSubject.ts +0 -0
- /package/{api → dist/api}/types/ApiBurst.ts +0 -0
- /package/{api → dist/api}/types/ApiBurstTenantadm.ts +0 -0
- /package/{api → dist/api}/types/ApiLimits.ts +0 -0
- /package/{api → dist/api}/types/ApiLimitsTenantadm.ts +0 -0
- /package/{api → dist/api}/types/ApiQuota.ts +0 -0
- /package/{api → dist/api}/types/ApiQuotaTenantadm.ts +0 -0
- /package/{api → dist/api}/types/Artifact.ts +0 -0
- /package/{api → dist/api}/types/ArtifactDeployments.ts +0 -0
- /package/{api → dist/api}/types/ArtifactInfo.ts +0 -0
- /package/{api → dist/api}/types/ArtifactInfoDeployments.ts +0 -0
- /package/{api → dist/api}/types/ArtifactLink.ts +0 -0
- /package/{api → dist/api}/types/ArtifactTypeInfo.ts +0 -0
- /package/{api → dist/api}/types/ArtifactTypeInfoDeployments.ts +0 -0
- /package/{api → dist/api}/types/ArtifactUpdate.ts +0 -0
- /package/{api → dist/api}/types/ArtifactUploadLink.ts +0 -0
- /package/{api → dist/api}/types/Attribute.ts +0 -0
- /package/{api → dist/api}/types/AttributeInventory.ts +0 -0
- /package/{api → dist/api}/types/AuditLog.ts +0 -0
- /package/{api → dist/api}/types/AuthSetDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/AutoAuthRequest.ts +0 -0
- /package/{api → dist/api}/types/AzureSharedAccessSecret.ts +0 -0
- /package/{api → dist/api}/types/BillingInfo.ts +0 -0
- /package/{api → dist/api}/types/BinaryDeltaConfiguration.ts +0 -0
- /package/{api → dist/api}/types/BinaryDeltaConfigurationDeployments.ts +0 -0
- /package/{api → dist/api}/types/BinaryDeltaLimitsDeployments.ts +0 -0
- /package/{api → dist/api}/types/CancelRequest.ts +0 -0
- /package/{api → dist/api}/types/CardData.ts +0 -0
- /package/{api → dist/api}/types/CardSetupData.ts +0 -0
- /package/{api → dist/api}/types/CheckoutData.ts +0 -0
- /package/{api → dist/api}/types/Configuration.ts +0 -0
- /package/{api → dist/api}/types/Count.ts +0 -0
- /package/{api → dist/api}/types/Credentials.ts +0 -0
- /package/{api → dist/api}/types/DBusSubsystem.ts +0 -0
- /package/{api → dist/api}/types/DeltaConfiguration.ts +0 -0
- /package/{api → dist/api}/types/DeltaConfigurationDeployments.ts +0 -0
- /package/{api → dist/api}/types/DeploymentAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/DeploymentIdentifier.ts +0 -0
- /package/{api → dist/api}/types/DeploymentPhase.ts +0 -0
- /package/{api → dist/api}/types/DeploymentReporting.ts +0 -0
- /package/{api → dist/api}/types/DeploymentStatistics.ts +0 -0
- /package/{api → dist/api}/types/DeploymentStatusStatistics.ts +0 -0
- /package/{api → dist/api}/types/DeviceAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/DeviceAuthEvent.ts +0 -0
- /package/{api → dist/api}/types/DeviceConfiguration.ts +0 -0
- /package/{api → dist/api}/types/DeviceDeployment.ts +0 -0
- /package/{api → dist/api}/types/DeviceDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/DeviceInventory.ts +0 -0
- /package/{api → dist/api}/types/DeviceInventoryInventory.ts +0 -0
- /package/{api → dist/api}/types/DeviceReporting.ts +0 -0
- /package/{api → dist/api}/types/DeviceState.ts +0 -0
- /package/{api → dist/api}/types/DeviceStateDeviceconnect.ts +0 -0
- /package/{api → dist/api}/types/DeviceStateIot_manager.ts +0 -0
- /package/{api → dist/api}/types/DeviceStatus.ts +0 -0
- /package/{api → dist/api}/types/DeviceWithImage.ts +0 -0
- /package/{api → dist/api}/types/DirectUploadMetadata.ts +0 -0
- /package/{api → dist/api}/types/EmailVerificationCompletion.ts +0 -0
- /package/{api → dist/api}/types/EmailVerificationRequest.ts +0 -0
- /package/{api → dist/api}/types/ErrorAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeployments.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeviceconfig.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeviceconnect.ts +0 -0
- /package/{api → dist/api}/types/ErrorDevicemonitor.ts +0 -0
- /package/{api → dist/api}/types/ErrorExt.ts +0 -0
- /package/{api → dist/api}/types/ErrorInventory.ts +0 -0
- /package/{api → dist/api}/types/ErrorIot_manager.ts +0 -0
- /package/{api → dist/api}/types/ErrorNotFound.ts +0 -0
- /package/{api → dist/api}/types/ErrorReporting.ts +0 -0
- /package/{api → dist/api}/types/ErrorTenantadm.ts +0 -0
- /package/{api → dist/api}/types/ErrorUseradm.ts +0 -0
- /package/{api → dist/api}/types/Event.ts +0 -0
- /package/{api → dist/api}/types/ExternalIdentity.ts +0 -0
- /package/{api → dist/api}/types/Features.ts +0 -0
- /package/{api → dist/api}/types/FileUpload.ts +0 -0
- /package/{api → dist/api}/types/FilterAttribute.ts +0 -0
- /package/{api → dist/api}/types/FilterDefinition.ts +0 -0
- /package/{api → dist/api}/types/FilterDeployments.ts +0 -0
- /package/{api → dist/api}/types/FilterPredicateDeployments.ts +0 -0
- /package/{api → dist/api}/types/Group.ts +0 -0
- /package/{api → dist/api}/types/HTTP.ts +0 -0
- /package/{api → dist/api}/types/IdentityData.ts +0 -0
- /package/{api → dist/api}/types/InputParameter.ts +0 -0
- /package/{api → dist/api}/types/JobStatus.ts +0 -0
- /package/{api → dist/api}/types/Limit.ts +0 -0
- /package/{api → dist/api}/types/LimitDeployments.ts +0 -0
- /package/{api → dist/api}/types/LimitDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/LimitUseradm.ts +0 -0
- /package/{api → dist/api}/types/Limits.ts +0 -0
- /package/{api → dist/api}/types/LineDescriptor.ts +0 -0
- /package/{api → dist/api}/types/LogSubsystem.ts +0 -0
- /package/{api → dist/api}/types/LoginOptions.ts +0 -0
- /package/{api → dist/api}/types/ManagementAPIConfiguration.ts +0 -0
- /package/{api → dist/api}/types/MonitorConfiguration.ts +0 -0
- /package/{api → dist/api}/types/NewConfigurationDeployment.ts +0 -0
- /package/{api → dist/api}/types/NewConfigurationDeploymentResponse.ts +0 -0
- /package/{api → dist/api}/types/NewDeployment.ts +0 -0
- /package/{api → dist/api}/types/NewDeploymentForGroup.ts +0 -0
- /package/{api → dist/api}/types/NewDeploymentPhase.ts +0 -0
- /package/{api → dist/api}/types/NewDeploymentPhaseDeployments.ts +0 -0
- /package/{api → dist/api}/types/OwnUserUpdate.ts +0 -0
- /package/{api → dist/api}/types/PasswordResetCompletion.ts +0 -0
- /package/{api → dist/api}/types/PasswordResetRequest.ts +0 -0
- /package/{api → dist/api}/types/Permission.ts +0 -0
- /package/{api → dist/api}/types/PermissionObject.ts +0 -0
- /package/{api → dist/api}/types/PermissionSet.ts +0 -0
- /package/{api → dist/api}/types/PermissionSetWithScope.ts +0 -0
- /package/{api → dist/api}/types/PersonalAccessToken.ts +0 -0
- /package/{api → dist/api}/types/PersonalAccessTokenRequest.ts +0 -0
- /package/{api → dist/api}/types/Plan.ts +0 -0
- /package/{api → dist/api}/types/PlanBindingDetails.ts +0 -0
- /package/{api → dist/api}/types/PlanChangeRequest.ts +0 -0
- /package/{api → dist/api}/types/PlanLimits.ts +0 -0
- /package/{api → dist/api}/types/Release.ts +0 -0
- /package/{api → dist/api}/types/ReleaseDeployments.ts +0 -0
- /package/{api → dist/api}/types/ReleaseUpdate.ts +0 -0
- /package/{api → dist/api}/types/Releases.ts +0 -0
- /package/{api → dist/api}/types/ReleasesDeleteError.ts +0 -0
- /package/{api → dist/api}/types/ReleasesDeployments.ts +0 -0
- /package/{api → dist/api}/types/Role.ts +0 -0
- /package/{api → dist/api}/types/RolePermission.ts +0 -0
- /package/{api → dist/api}/types/RolePermissionObject.ts +0 -0
- /package/{api → dist/api}/types/RoleUseradm.ts +0 -0
- /package/{api → dist/api}/types/SAMLMetadata.ts +0 -0
- /package/{api → dist/api}/types/Scope.ts +0 -0
- /package/{api → dist/api}/types/SelectAttribute.ts +0 -0
- /package/{api → dist/api}/types/ServiceSubsystem.ts +0 -0
- /package/{api → dist/api}/types/SortCriteria.ts +0 -0
- /package/{api → dist/api}/types/SsoObject.ts +0 -0
- /package/{api → dist/api}/types/StatusDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/StorageLimit.ts +0 -0
- /package/{api → dist/api}/types/SubscriptionData.ts +0 -0
- /package/{api → dist/api}/types/SupportRequest.ts +0 -0
- /package/{api → dist/api}/types/Tag.ts +0 -0
- /package/{api → dist/api}/types/Tags.ts +0 -0
- /package/{api → dist/api}/types/TaskResult.ts +0 -0
- /package/{api → dist/api}/types/TaskResultCLI.ts +0 -0
- /package/{api → dist/api}/types/TaskResultHTTPRequest.ts +0 -0
- /package/{api → dist/api}/types/TaskResultHTTPResponse.ts +0 -0
- /package/{api → dist/api}/types/TenantApiLimits.ts +0 -0
- /package/{api → dist/api}/types/TenantApiLimitsTenantadm.ts +0 -0
- /package/{api → dist/api}/types/TenantIdName.ts +0 -0
- /package/{api → dist/api}/types/TenantIdsData.ts +0 -0
- /package/{api → dist/api}/types/TenantInfo.ts +0 -0
- /package/{api → dist/api}/types/TenantShortInfo.ts +0 -0
- /package/{api → dist/api}/types/TenantsIdName.ts +0 -0
- /package/{api → dist/api}/types/Update.ts +0 -0
- /package/{api → dist/api}/types/UpdateFile.ts +0 -0
- /package/{api → dist/api}/types/UpdateFileDeployments.ts +0 -0
- /package/{api → dist/api}/types/UpdateTypes.ts +0 -0
- /package/{api → dist/api}/types/User.ts +0 -0
- /package/{api → dist/api}/types/UserAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/UserNew.ts +0 -0
- /package/{api → dist/api}/types/UserUpdate.ts +0 -0
- /package/{api → dist/api}/types/UserUseradm.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgs.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgsDeployments.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgsLimits.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgsLimitsDeployments.ts +0 -0
|
@@ -1,660 +0,0 @@
|
|
|
1
|
-
// Copyright 2020 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 { getSessionInfo } from '@northern.tech/store/auth';
|
|
16
|
-
import { emptyRole } from '@northern.tech/store/commonConstants';
|
|
17
|
-
import { setOfflineThreshold } from '@northern.tech/store/thunks';
|
|
18
|
-
import { act } from '@testing-library/react';
|
|
19
|
-
import configureMockStore from 'redux-mock-store';
|
|
20
|
-
import { thunk } from 'redux-thunk';
|
|
21
|
-
import Cookies from 'universal-cookie';
|
|
22
|
-
|
|
23
|
-
import { actions } from '.';
|
|
24
|
-
import { accessTokens, defaultPassword, defaultState, receivedPermissionSets, receivedRoles, testSsoId, userId } from '../../../../tests/mockData';
|
|
25
|
-
import { HELPTOOLTIPS } from '../../components/helptips/helptooltips';
|
|
26
|
-
import { actions as appActions } from '../appSlice';
|
|
27
|
-
import { getSamlStartUrl } from '../organizationSlice/constants';
|
|
28
|
-
import { USER_LOGOUT, uiPermissionsById } from './constants';
|
|
29
|
-
import {
|
|
30
|
-
addUserToCurrentTenant,
|
|
31
|
-
createRole,
|
|
32
|
-
createUser,
|
|
33
|
-
disableUser2fa,
|
|
34
|
-
editRole,
|
|
35
|
-
editUser,
|
|
36
|
-
enableUser2fa,
|
|
37
|
-
generateToken,
|
|
38
|
-
get2FAQRCode,
|
|
39
|
-
getGlobalSettings,
|
|
40
|
-
getPermissionSets,
|
|
41
|
-
getRoles,
|
|
42
|
-
getTokens,
|
|
43
|
-
getUser,
|
|
44
|
-
getUserList,
|
|
45
|
-
getUserSettings,
|
|
46
|
-
initializeSelf,
|
|
47
|
-
loginUser,
|
|
48
|
-
logoutUser,
|
|
49
|
-
passwordResetComplete,
|
|
50
|
-
passwordResetStart,
|
|
51
|
-
removeRole,
|
|
52
|
-
removeUser,
|
|
53
|
-
revokeToken,
|
|
54
|
-
saveGlobalSettings,
|
|
55
|
-
saveUserSettings,
|
|
56
|
-
setAllTooltipsReadState,
|
|
57
|
-
setHideAnnouncement,
|
|
58
|
-
setTooltipReadState,
|
|
59
|
-
switchUserOrganization,
|
|
60
|
-
updateUserColumnSettings,
|
|
61
|
-
verify2FA,
|
|
62
|
-
verifyEmailComplete,
|
|
63
|
-
verifyEmailStart
|
|
64
|
-
} from './thunks';
|
|
65
|
-
|
|
66
|
-
const middlewares = [thunk];
|
|
67
|
-
const mockStore = configureMockStore(middlewares);
|
|
68
|
-
|
|
69
|
-
const defaultRole = { ...emptyRole, name: 'test', description: 'test description' };
|
|
70
|
-
const settings = { test: true };
|
|
71
|
-
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
73
|
-
const { attributes, ...expectedDevice } = defaultState.devices.byId.a1;
|
|
74
|
-
|
|
75
|
-
export const offlineThreshold = [
|
|
76
|
-
{ type: setOfflineThreshold.pending.type },
|
|
77
|
-
{ type: appActions.setOfflineThreshold.type, payload: '2019-01-12T13:00:00.900Z' },
|
|
78
|
-
{ type: setOfflineThreshold.fulfilled.type }
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
/* eslint-disable sonarjs/no-identical-functions */
|
|
82
|
-
describe('user actions', () => {
|
|
83
|
-
it('should allow retrieving 2fa qr codes', async () => {
|
|
84
|
-
jest.clearAllMocks();
|
|
85
|
-
const expectedActions = [
|
|
86
|
-
{ type: get2FAQRCode.pending.type },
|
|
87
|
-
{ type: actions.receivedQrCode.type, payload: btoa('test') },
|
|
88
|
-
{ type: get2FAQRCode.fulfilled.type }
|
|
89
|
-
];
|
|
90
|
-
const store = mockStore({ ...defaultState });
|
|
91
|
-
await store.dispatch(get2FAQRCode(true));
|
|
92
|
-
const storeActions = store.getActions();
|
|
93
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
94
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const commonUserRetrievalActions = [
|
|
98
|
-
{ type: setHideAnnouncement.pending.type },
|
|
99
|
-
{ type: updateUserColumnSettings.pending.type },
|
|
100
|
-
{ type: actions.setCustomColumns.type, payload: [] },
|
|
101
|
-
{ type: setHideAnnouncement.fulfilled.type },
|
|
102
|
-
{ type: updateUserColumnSettings.fulfilled.type },
|
|
103
|
-
{ type: getUser.fulfilled.type }
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
it('should verify 2fa codes during 2fa setup', async () => {
|
|
107
|
-
jest.clearAllMocks();
|
|
108
|
-
const expectedActions = [
|
|
109
|
-
{ type: verify2FA.pending.type },
|
|
110
|
-
{ type: getUser.pending.type },
|
|
111
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId[userId] },
|
|
112
|
-
...commonUserRetrievalActions,
|
|
113
|
-
{ type: verify2FA.fulfilled.type }
|
|
114
|
-
];
|
|
115
|
-
const store = mockStore({ ...defaultState });
|
|
116
|
-
await store.dispatch(verify2FA({ token2fa: '123456' }));
|
|
117
|
-
const storeActions = store.getActions();
|
|
118
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
119
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
120
|
-
});
|
|
121
|
-
it('should allow enabling 2fa during 2fa setup', async () => {
|
|
122
|
-
jest.clearAllMocks();
|
|
123
|
-
const expectedActions = [
|
|
124
|
-
{ type: enableUser2fa.pending.type },
|
|
125
|
-
{ type: getUser.pending.type },
|
|
126
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId.a1 },
|
|
127
|
-
...commonUserRetrievalActions,
|
|
128
|
-
{ type: enableUser2fa.fulfilled.type }
|
|
129
|
-
];
|
|
130
|
-
const store = mockStore({ ...defaultState });
|
|
131
|
-
await store.dispatch(enableUser2fa(defaultState.users.byId.a1.id));
|
|
132
|
-
const storeActions = store.getActions();
|
|
133
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
134
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
135
|
-
});
|
|
136
|
-
it('should allow disabling 2fa during 2fa setup', async () => {
|
|
137
|
-
jest.clearAllMocks();
|
|
138
|
-
const expectedActions = [
|
|
139
|
-
{ type: disableUser2fa.pending.type },
|
|
140
|
-
{ type: getUser.pending.type },
|
|
141
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId.a1 },
|
|
142
|
-
...commonUserRetrievalActions,
|
|
143
|
-
{ type: disableUser2fa.fulfilled.type }
|
|
144
|
-
];
|
|
145
|
-
const store = mockStore({ ...defaultState });
|
|
146
|
-
await store.dispatch(disableUser2fa(defaultState.users.byId.a1.id));
|
|
147
|
-
const storeActions = store.getActions();
|
|
148
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
149
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
150
|
-
});
|
|
151
|
-
it('should allow beginning email verification', async () => {
|
|
152
|
-
jest.clearAllMocks();
|
|
153
|
-
const expectedActions = [
|
|
154
|
-
{ type: verifyEmailStart.pending.type },
|
|
155
|
-
{ type: getUser.pending.type },
|
|
156
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId[userId] },
|
|
157
|
-
...commonUserRetrievalActions,
|
|
158
|
-
{ type: verifyEmailStart.fulfilled.type }
|
|
159
|
-
];
|
|
160
|
-
const store = mockStore({ ...defaultState });
|
|
161
|
-
await store.dispatch(verifyEmailStart());
|
|
162
|
-
const storeActions = store.getActions();
|
|
163
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
164
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
165
|
-
});
|
|
166
|
-
it('should allow completing email verification', async () => {
|
|
167
|
-
jest.clearAllMocks();
|
|
168
|
-
const expectedActions = [
|
|
169
|
-
{ type: verifyEmailComplete.pending.type },
|
|
170
|
-
{ type: getUser.pending.type },
|
|
171
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId[userId] },
|
|
172
|
-
...commonUserRetrievalActions,
|
|
173
|
-
{ type: verifyEmailComplete.fulfilled.type }
|
|
174
|
-
];
|
|
175
|
-
const store = mockStore({ ...defaultState });
|
|
176
|
-
await store.dispatch(verifyEmailComplete('superSecret'));
|
|
177
|
-
const storeActions = store.getActions();
|
|
178
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
179
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
180
|
-
await expect(store.dispatch(verifyEmailComplete('ohNo')).unwrap()).rejects.toBeTruthy();
|
|
181
|
-
});
|
|
182
|
-
it('should allow logging in', async () => {
|
|
183
|
-
jest.clearAllMocks();
|
|
184
|
-
const expectedActions = [
|
|
185
|
-
{ type: loginUser.pending.type },
|
|
186
|
-
{ type: getUser.pending.type },
|
|
187
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId[userId] },
|
|
188
|
-
...commonUserRetrievalActions,
|
|
189
|
-
{ type: actions.successfullyLoggedIn.type, payload: getSessionInfo() },
|
|
190
|
-
{ type: loginUser.fulfilled.type }
|
|
191
|
-
];
|
|
192
|
-
const store = mockStore({ ...defaultState });
|
|
193
|
-
await store.dispatch(loginUser({ email: 'test@example.com', password: defaultPassword }));
|
|
194
|
-
const storeActions = store.getActions();
|
|
195
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
196
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
197
|
-
});
|
|
198
|
-
it('should redirect on SSO login', async () => {
|
|
199
|
-
const store = mockStore({ ...defaultState });
|
|
200
|
-
const replaceSpy = jest.spyOn(window.location, 'replace');
|
|
201
|
-
await store.dispatch(loginUser({ email: 'test@example.com' }));
|
|
202
|
-
await act(async () => {
|
|
203
|
-
jest.runOnlyPendingTimers();
|
|
204
|
-
jest.runAllTicks();
|
|
205
|
-
});
|
|
206
|
-
expect(replaceSpy).toHaveBeenCalledWith(getSamlStartUrl(testSsoId));
|
|
207
|
-
});
|
|
208
|
-
it('should prevent logging in with a limited user', async () => {
|
|
209
|
-
jest.clearAllMocks();
|
|
210
|
-
window.localStorage.getItem.mockReturnValueOnce(JSON.stringify({ token: 'limitedToken' }));
|
|
211
|
-
const expectedActions = [
|
|
212
|
-
{ type: loginUser.pending.type },
|
|
213
|
-
{ type: getUser.pending.type },
|
|
214
|
-
{ type: getUser.rejected.type },
|
|
215
|
-
{ type: appActions.setSnackbar.type, payload: 'forbidden by role-based access control' },
|
|
216
|
-
// {
|
|
217
|
-
// type: appActions.setSnackbar.type,
|
|
218
|
-
// payload: 'There was a problem logging in. Please check your email and password. If you still have problems, contact an administrator.'
|
|
219
|
-
// },
|
|
220
|
-
{ type: loginUser.rejected.type }
|
|
221
|
-
];
|
|
222
|
-
const store = mockStore({ ...defaultState });
|
|
223
|
-
try {
|
|
224
|
-
await store.dispatch(loginUser({ email: 'test-limited@example.com', password: defaultPassword }));
|
|
225
|
-
} catch (error) {
|
|
226
|
-
expect(error).toMatchObject(expectedActions[5]);
|
|
227
|
-
}
|
|
228
|
-
await act(async () => {
|
|
229
|
-
jest.runOnlyPendingTimers();
|
|
230
|
-
jest.runAllTicks();
|
|
231
|
-
});
|
|
232
|
-
expect(window.localStorage.removeItem).toHaveBeenCalledWith('JWT');
|
|
233
|
-
window.localStorage.getItem.mockReset();
|
|
234
|
-
const storeActions = store.getActions();
|
|
235
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
236
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
237
|
-
});
|
|
238
|
-
it('should allow logging out', async () => {
|
|
239
|
-
jest.clearAllMocks();
|
|
240
|
-
const expectedActions = [{ type: logoutUser.pending.type }, { type: USER_LOGOUT }, { type: logoutUser.fulfilled.type }];
|
|
241
|
-
const store = mockStore({ ...defaultState });
|
|
242
|
-
await store.dispatch(logoutUser());
|
|
243
|
-
const storeActions = store.getActions();
|
|
244
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
245
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
246
|
-
});
|
|
247
|
-
it('should not allow logging out with an active upload', async () => {
|
|
248
|
-
jest.clearAllMocks();
|
|
249
|
-
const store = mockStore({ ...defaultState, releases: { ...defaultState.releases, uploadProgress: 42 } });
|
|
250
|
-
await store.dispatch(logoutUser()).catch(() => expect(true).toEqual(true));
|
|
251
|
-
});
|
|
252
|
-
it('should allow switching users', async () => {
|
|
253
|
-
jest.clearAllMocks();
|
|
254
|
-
const reloadSpy = jest.spyOn(window.location, 'reload');
|
|
255
|
-
const store = mockStore({ ...defaultState, releases: { ...defaultState.releases, uploadProgress: 42 } });
|
|
256
|
-
await store.dispatch(switchUserOrganization('a1'));
|
|
257
|
-
expect(localStorage.getItem).toHaveBeenCalledWith('JWT');
|
|
258
|
-
expect(localStorage.setItem).toHaveBeenCalledWith('JWT', JSON.stringify({ token: 'differentToken' }));
|
|
259
|
-
expect(reloadSpy).toHaveBeenCalled();
|
|
260
|
-
});
|
|
261
|
-
it('should not allow switching users during uploads', async () => {
|
|
262
|
-
jest.clearAllMocks();
|
|
263
|
-
const store = mockStore({ ...defaultState, releases: { ...defaultState.releases, uploadProgress: 42 } });
|
|
264
|
-
await store.dispatch(switchUserOrganization('a1')).catch(() => expect(true).toEqual(true));
|
|
265
|
-
});
|
|
266
|
-
it('should allow single user retrieval', async () => {
|
|
267
|
-
jest.clearAllMocks();
|
|
268
|
-
const expectedActions = [
|
|
269
|
-
{ type: getUser.pending.type },
|
|
270
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId.a1 },
|
|
271
|
-
...commonUserRetrievalActions
|
|
272
|
-
];
|
|
273
|
-
const store = mockStore({ ...defaultState });
|
|
274
|
-
await store.dispatch(getUser('a1'));
|
|
275
|
-
const storeActions = store.getActions();
|
|
276
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
277
|
-
// we can't check for the correct value here as the localstorage is (ab)used by msw to track state during req/res cycles, thus the localStorage expectation
|
|
278
|
-
expect(window.localStorage.getItem).toHaveBeenCalledWith(`a1-column-widths`);
|
|
279
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
280
|
-
});
|
|
281
|
-
it('should allow current user initialization', async () => {
|
|
282
|
-
jest.clearAllMocks();
|
|
283
|
-
const expectedActions = [
|
|
284
|
-
{ type: initializeSelf.pending.type },
|
|
285
|
-
{ type: getUser.pending.type },
|
|
286
|
-
{ type: actions.receivedUser.type, payload: defaultState.users.byId[userId] },
|
|
287
|
-
...commonUserRetrievalActions,
|
|
288
|
-
{ type: initializeSelf.fulfilled.type }
|
|
289
|
-
];
|
|
290
|
-
const store = mockStore({ ...defaultState });
|
|
291
|
-
await store.dispatch(initializeSelf());
|
|
292
|
-
const storeActions = store.getActions();
|
|
293
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
294
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
295
|
-
});
|
|
296
|
-
it('should allow user list retrieval', async () => {
|
|
297
|
-
jest.clearAllMocks();
|
|
298
|
-
const expectedActions = [
|
|
299
|
-
{ type: getUserList.pending.type },
|
|
300
|
-
{ type: actions.receivedUserList.type, payload: defaultState.users.byId },
|
|
301
|
-
{ type: getUserList.fulfilled.type }
|
|
302
|
-
];
|
|
303
|
-
const store = mockStore({ ...defaultState });
|
|
304
|
-
await store.dispatch(getUserList());
|
|
305
|
-
const storeActions = store.getActions();
|
|
306
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
307
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
308
|
-
});
|
|
309
|
-
it('should allow single user creation', async () => {
|
|
310
|
-
jest.clearAllMocks();
|
|
311
|
-
const createdUser = { email: 'a@b.com', password: defaultPassword };
|
|
312
|
-
const expectedActions = [
|
|
313
|
-
{ type: createUser.pending.type },
|
|
314
|
-
{ type: actions.createdUser.type, payload: createdUser },
|
|
315
|
-
{ type: getUserList.pending.type },
|
|
316
|
-
{ type: appActions.setSnackbar.type, payload: 'The user was created successfully.' },
|
|
317
|
-
{ type: actions.receivedUserList.type, payload: defaultState.users.byId },
|
|
318
|
-
{ type: getUserList.fulfilled.type },
|
|
319
|
-
{ type: createUser.fulfilled.type }
|
|
320
|
-
];
|
|
321
|
-
const store = mockStore({ ...defaultState });
|
|
322
|
-
await store.dispatch(createUser(createdUser));
|
|
323
|
-
const storeActions = store.getActions();
|
|
324
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
325
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
326
|
-
});
|
|
327
|
-
it('should allow single user edits', async () => {
|
|
328
|
-
jest.clearAllMocks();
|
|
329
|
-
const expectedActions = [
|
|
330
|
-
{ type: editUser.pending.type },
|
|
331
|
-
{ type: actions.updatedUser.type, payload: { id: 'a1', password: defaultPassword } },
|
|
332
|
-
{ type: appActions.setSnackbar.type, payload: 'The user has been updated.' },
|
|
333
|
-
{ type: editUser.fulfilled.type }
|
|
334
|
-
];
|
|
335
|
-
const store = mockStore({ ...defaultState });
|
|
336
|
-
await store.dispatch(editUser({ id: 'a1', email: defaultState.users.byId.a1.email, password: defaultPassword }));
|
|
337
|
-
const storeActions = store.getActions();
|
|
338
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
339
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
340
|
-
});
|
|
341
|
-
it('should not allow current user edits without proper password', async () => {
|
|
342
|
-
jest.clearAllMocks();
|
|
343
|
-
const store = mockStore({ ...defaultState });
|
|
344
|
-
await expect(store.dispatch(editUser({ id: 'a1', email: 'a@evil.com', password: 'mySecretPasswordNot' })).unwrap()).rejects.toBeTruthy();
|
|
345
|
-
});
|
|
346
|
-
it('should allow single user removal', async () => {
|
|
347
|
-
jest.clearAllMocks();
|
|
348
|
-
const expectedActions = [
|
|
349
|
-
{ type: removeUser.pending.type },
|
|
350
|
-
{ type: actions.removedUser.type, payload: 'a1' },
|
|
351
|
-
{ type: getUserList.pending.type },
|
|
352
|
-
{ type: appActions.setSnackbar.type, payload: 'The user was removed from the system.' },
|
|
353
|
-
{ type: actions.receivedUserList.type, payload: defaultState.users.byId },
|
|
354
|
-
{ type: getUserList.fulfilled.type },
|
|
355
|
-
{ type: removeUser.fulfilled.type }
|
|
356
|
-
];
|
|
357
|
-
const store = mockStore({ ...defaultState });
|
|
358
|
-
await store.dispatch(removeUser('a1'));
|
|
359
|
-
const storeActions = store.getActions();
|
|
360
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
361
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
362
|
-
});
|
|
363
|
-
it('should allow single user removal', async () => {
|
|
364
|
-
jest.clearAllMocks();
|
|
365
|
-
const expectedActions = [
|
|
366
|
-
{ type: addUserToCurrentTenant.pending.type },
|
|
367
|
-
{ type: appActions.setSnackbar.type, payload: 'The user was added successfully.' },
|
|
368
|
-
{ type: getUserList.pending.type },
|
|
369
|
-
{ type: actions.receivedUserList.type, payload: defaultState.users.byId },
|
|
370
|
-
{ type: getUserList.fulfilled.type },
|
|
371
|
-
{ type: addUserToCurrentTenant.fulfilled.type }
|
|
372
|
-
];
|
|
373
|
-
const store = mockStore({ ...defaultState });
|
|
374
|
-
await store.dispatch(addUserToCurrentTenant('a1'));
|
|
375
|
-
const storeActions = store.getActions();
|
|
376
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
377
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
it('should allow role list retrieval', async () => {
|
|
381
|
-
jest.clearAllMocks();
|
|
382
|
-
const expectedActions = [
|
|
383
|
-
{ type: getRoles.pending.type },
|
|
384
|
-
{ type: getPermissionSets.pending.type },
|
|
385
|
-
{ type: actions.receivedPermissionSets.type, payload: receivedPermissionSets },
|
|
386
|
-
{ type: getPermissionSets.fulfilled.type },
|
|
387
|
-
{ type: actions.receivedRoles.type, payload: receivedRoles },
|
|
388
|
-
{ type: getRoles.fulfilled.type }
|
|
389
|
-
];
|
|
390
|
-
const store = mockStore({ ...defaultState });
|
|
391
|
-
await store.dispatch(getRoles());
|
|
392
|
-
await act(async () => {
|
|
393
|
-
jest.runOnlyPendingTimers();
|
|
394
|
-
jest.runAllTicks();
|
|
395
|
-
});
|
|
396
|
-
const storeActions = store.getActions();
|
|
397
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
398
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
399
|
-
});
|
|
400
|
-
it('should allow role creation', async () => {
|
|
401
|
-
jest.clearAllMocks();
|
|
402
|
-
const expectedActions = [
|
|
403
|
-
{ type: createRole.pending.type },
|
|
404
|
-
{ type: actions.createdRole.type, payload: defaultRole },
|
|
405
|
-
{ type: getRoles.pending.type },
|
|
406
|
-
{ type: getPermissionSets.pending.type },
|
|
407
|
-
{ type: appActions.setSnackbar.type, payload: 'The role was created successfully.' },
|
|
408
|
-
{ type: actions.receivedPermissionSets.type, payload: receivedPermissionSets },
|
|
409
|
-
{ type: getPermissionSets.fulfilled.type },
|
|
410
|
-
{ type: actions.receivedRoles.type, payload: receivedRoles },
|
|
411
|
-
{ type: getRoles.fulfilled.type },
|
|
412
|
-
{ type: createRole.fulfilled.type }
|
|
413
|
-
];
|
|
414
|
-
const store = mockStore({ ...defaultState });
|
|
415
|
-
await store.dispatch(createRole({ ...defaultRole, uiPermissions: { groups: [{ item: 'testGroup', uiPermissions: [uiPermissionsById.manage.value] }] } }));
|
|
416
|
-
const storeActions = store.getActions();
|
|
417
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
418
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
419
|
-
});
|
|
420
|
-
it('should allow role edits', async () => {
|
|
421
|
-
jest.clearAllMocks();
|
|
422
|
-
const expectedActions = [
|
|
423
|
-
{ type: editRole.pending.type },
|
|
424
|
-
{
|
|
425
|
-
type: actions.createdRole.type,
|
|
426
|
-
payload: {
|
|
427
|
-
...defaultRole,
|
|
428
|
-
name: defaultRole.name,
|
|
429
|
-
uiPermissions: {
|
|
430
|
-
...defaultRole.uiPermissions,
|
|
431
|
-
groups: { ...defaultRole.uiPermissions.groups, testGroup: [uiPermissionsById.manage.value] }
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
{ type: getRoles.pending.type },
|
|
436
|
-
{ type: getPermissionSets.pending.type },
|
|
437
|
-
{ type: appActions.setSnackbar.type, payload: 'The role has been updated.' },
|
|
438
|
-
{ type: actions.receivedPermissionSets.type, payload: receivedPermissionSets },
|
|
439
|
-
{ type: getPermissionSets.fulfilled.type },
|
|
440
|
-
{ type: actions.receivedRoles.type, payload: receivedRoles },
|
|
441
|
-
{ type: getRoles.fulfilled.type },
|
|
442
|
-
{ type: editRole.fulfilled.type }
|
|
443
|
-
];
|
|
444
|
-
const store = mockStore({ ...defaultState });
|
|
445
|
-
await store.dispatch(
|
|
446
|
-
editRole({ name: defaultRole.name, uiPermissions: { groups: [{ item: 'testGroup', uiPermissions: [uiPermissionsById.manage.value] }] } })
|
|
447
|
-
);
|
|
448
|
-
const storeActions = store.getActions();
|
|
449
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
450
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
451
|
-
});
|
|
452
|
-
it('should allow role removal', async () => {
|
|
453
|
-
jest.clearAllMocks();
|
|
454
|
-
const expectedActions = [
|
|
455
|
-
{ type: removeRole.pending.type },
|
|
456
|
-
{ type: actions.removedRole.type, payload: 'test' },
|
|
457
|
-
{ type: getRoles.pending.type },
|
|
458
|
-
{ type: getPermissionSets.pending.type },
|
|
459
|
-
{ type: appActions.setSnackbar.type, payload: 'The role was deleted successfully.' },
|
|
460
|
-
{ type: actions.receivedPermissionSets.type, payload: receivedPermissionSets },
|
|
461
|
-
{ type: getPermissionSets.fulfilled.type },
|
|
462
|
-
{ type: actions.receivedRoles.type, payload: receivedRoles },
|
|
463
|
-
{ type: getRoles.fulfilled.type },
|
|
464
|
-
{ type: removeRole.fulfilled.type }
|
|
465
|
-
];
|
|
466
|
-
const store = mockStore({ ...defaultState });
|
|
467
|
-
await store.dispatch(removeRole('test'));
|
|
468
|
-
const storeActions = store.getActions();
|
|
469
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
470
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
471
|
-
});
|
|
472
|
-
it('should allow password reset - pt. 1', async () => {
|
|
473
|
-
const store = mockStore({ ...defaultState });
|
|
474
|
-
await store.dispatch(passwordResetStart(defaultState.users.byId.a1.email)).then(() => expect(true).toEqual(true));
|
|
475
|
-
});
|
|
476
|
-
it('should allow password reset - pt. 2', async () => {
|
|
477
|
-
const store = mockStore({ ...defaultState });
|
|
478
|
-
await store.dispatch(passwordResetComplete({ secretHash: 'secretHash', newPassword: 'newPassword' })).then(() => expect(true).toEqual(true));
|
|
479
|
-
});
|
|
480
|
-
it('should allow storing global settings without deletion', async () => {
|
|
481
|
-
jest.clearAllMocks();
|
|
482
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
483
|
-
const { id_attribute, ...retrievedSettings } = defaultState.users.globalSettings;
|
|
484
|
-
const expectedActions = [
|
|
485
|
-
{ type: saveGlobalSettings.pending.type },
|
|
486
|
-
{ type: getGlobalSettings.pending.type },
|
|
487
|
-
{ type: actions.setGlobalSettings.type, payload: { ...retrievedSettings } },
|
|
488
|
-
...offlineThreshold,
|
|
489
|
-
{ type: getGlobalSettings.fulfilled.type },
|
|
490
|
-
{ type: actions.setGlobalSettings.type, payload: { ...defaultState.users.globalSettings, ...settings } },
|
|
491
|
-
{ type: saveGlobalSettings.fulfilled.type }
|
|
492
|
-
];
|
|
493
|
-
const store = mockStore({ ...defaultState });
|
|
494
|
-
await store.dispatch(saveGlobalSettings(settings));
|
|
495
|
-
const storeActions = store.getActions();
|
|
496
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
497
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
498
|
-
});
|
|
499
|
-
it('should allow storing global settings without deletion and with notification', async () => {
|
|
500
|
-
jest.clearAllMocks();
|
|
501
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
502
|
-
const { id_attribute, ...retrievedSettings } = defaultState.users.globalSettings;
|
|
503
|
-
const expectedActions = [
|
|
504
|
-
{ type: saveGlobalSettings.pending.type },
|
|
505
|
-
{ type: getGlobalSettings.pending.type },
|
|
506
|
-
{ type: actions.setGlobalSettings.type, payload: { ...retrievedSettings } },
|
|
507
|
-
...offlineThreshold,
|
|
508
|
-
{ type: getGlobalSettings.fulfilled.type },
|
|
509
|
-
{ type: actions.setGlobalSettings.type, payload: { ...defaultState.users.globalSettings, ...settings } },
|
|
510
|
-
{ type: appActions.setSnackbar.type, payload: 'Settings saved successfully' },
|
|
511
|
-
{ type: saveGlobalSettings.fulfilled.type }
|
|
512
|
-
];
|
|
513
|
-
const store = mockStore({ ...defaultState });
|
|
514
|
-
await store.dispatch(saveGlobalSettings({ ...settings, notify: true }));
|
|
515
|
-
const storeActions = store.getActions();
|
|
516
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
517
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
518
|
-
});
|
|
519
|
-
it('should allow storing user scoped settings', async () => {
|
|
520
|
-
jest.clearAllMocks();
|
|
521
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
522
|
-
const { ...settings } = defaultState.users.userSettings;
|
|
523
|
-
const expectedActions = [
|
|
524
|
-
{ type: saveUserSettings.pending.type },
|
|
525
|
-
{ type: getUserSettings.pending.type },
|
|
526
|
-
{ type: actions.setUserSettings.type, payload: settings },
|
|
527
|
-
{ type: getUserSettings.fulfilled.type },
|
|
528
|
-
{ type: actions.setUserSettings.type, payload: { ...settings, extra: 'this' } },
|
|
529
|
-
{ type: saveUserSettings.fulfilled.type }
|
|
530
|
-
];
|
|
531
|
-
const store = mockStore({ ...defaultState });
|
|
532
|
-
await store.dispatch(saveUserSettings({ extra: 'this' }));
|
|
533
|
-
const storeActions = store.getActions();
|
|
534
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
535
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
536
|
-
});
|
|
537
|
-
it('should store the visibility of the announcement shown in the header in a cookie on dismissal', async () => {
|
|
538
|
-
jest.clearAllMocks();
|
|
539
|
-
const cookies = new Cookies();
|
|
540
|
-
const expectedActions = [
|
|
541
|
-
{ type: setHideAnnouncement.pending.type },
|
|
542
|
-
{ type: appActions.setAnnouncement.type, payload: undefined },
|
|
543
|
-
{ type: setHideAnnouncement.fulfilled.type }
|
|
544
|
-
];
|
|
545
|
-
const store = mockStore({ ...defaultState, app: { ...defaultState.app, hostedAnnouncement: 'something' } });
|
|
546
|
-
await store.dispatch(setHideAnnouncement({ shouldHide: true }));
|
|
547
|
-
const storeActions = store.getActions();
|
|
548
|
-
expect(cookies.get).toHaveBeenCalledTimes(1);
|
|
549
|
-
expect(cookies.set).toHaveBeenCalledTimes(1);
|
|
550
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
551
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
552
|
-
});
|
|
553
|
-
it('should store the sizes of columns in local storage', async () => {
|
|
554
|
-
jest.clearAllMocks();
|
|
555
|
-
const expectedActions = [
|
|
556
|
-
{ type: updateUserColumnSettings.pending.type },
|
|
557
|
-
{ type: actions.setCustomColumns.type, payload: [{ asd: 'asd' }] },
|
|
558
|
-
{ type: updateUserColumnSettings.fulfilled.type }
|
|
559
|
-
];
|
|
560
|
-
const store = mockStore({ ...defaultState, users: { ...defaultState.users, customColumns: [{ asd: 'asd' }] } });
|
|
561
|
-
await store.dispatch(updateUserColumnSettings({ columns: [{ asd: 'asd' }] }));
|
|
562
|
-
const storeActions = store.getActions();
|
|
563
|
-
expect(localStorage.getItem).not.toHaveBeenCalled();
|
|
564
|
-
expect(localStorage.setItem).toHaveBeenCalled();
|
|
565
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
566
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
567
|
-
|
|
568
|
-
jest.clearAllMocks();
|
|
569
|
-
await store.dispatch(updateUserColumnSettings({}));
|
|
570
|
-
expect(localStorage.getItem).toHaveBeenCalledTimes(1);
|
|
571
|
-
expect(localStorage.setItem).toHaveBeenCalledTimes(1);
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
it('should allow token list retrieval', async () => {
|
|
575
|
-
jest.clearAllMocks();
|
|
576
|
-
const expectedActions = [
|
|
577
|
-
{ type: getTokens.pending.type },
|
|
578
|
-
{ type: actions.updatedUser.type, payload: { id: 'a1', tokens: accessTokens } },
|
|
579
|
-
{ type: getTokens.fulfilled.type }
|
|
580
|
-
];
|
|
581
|
-
const store = mockStore({ ...defaultState });
|
|
582
|
-
await store.dispatch(getTokens());
|
|
583
|
-
const storeActions = store.getActions();
|
|
584
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
585
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
586
|
-
});
|
|
587
|
-
it('should allow token generation', async () => {
|
|
588
|
-
jest.clearAllMocks();
|
|
589
|
-
const expectedActions = [
|
|
590
|
-
{ type: generateToken.pending.type },
|
|
591
|
-
{ type: getTokens.pending.type },
|
|
592
|
-
{ type: actions.updatedUser.type, payload: { id: 'a1', tokens: accessTokens } },
|
|
593
|
-
{ type: getTokens.fulfilled.type },
|
|
594
|
-
{ type: generateToken.fulfilled.type }
|
|
595
|
-
];
|
|
596
|
-
const store = mockStore({ ...defaultState });
|
|
597
|
-
const result = await store.dispatch(generateToken({ name: 'name' })).unwrap();
|
|
598
|
-
const storeActions = store.getActions();
|
|
599
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
600
|
-
expect(result[result.length - 1]).toEqual('aNewToken');
|
|
601
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
602
|
-
});
|
|
603
|
-
it('should allow token removal', async () => {
|
|
604
|
-
jest.clearAllMocks();
|
|
605
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
606
|
-
const expectedActions = [
|
|
607
|
-
{ type: revokeToken.pending.type },
|
|
608
|
-
{ type: getTokens.pending.type },
|
|
609
|
-
{ type: actions.updatedUser.type, payload: { id: 'a1', tokens: accessTokens } },
|
|
610
|
-
{ type: getTokens.fulfilled.type },
|
|
611
|
-
{ type: revokeToken.fulfilled.type }
|
|
612
|
-
];
|
|
613
|
-
const store = mockStore({ ...defaultState });
|
|
614
|
-
await store.dispatch(revokeToken({ id: 'some-id-1' }));
|
|
615
|
-
const storeActions = store.getActions();
|
|
616
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
617
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
618
|
-
});
|
|
619
|
-
|
|
620
|
-
it('should handle setting single tooltip read state', async () => {
|
|
621
|
-
const store = mockStore({ ...defaultState });
|
|
622
|
-
const expectedActions = [
|
|
623
|
-
{ type: setTooltipReadState.pending.type },
|
|
624
|
-
{ type: actions.setTooltipState.type, payload: { id: 'foo', readState: 'testRead' } },
|
|
625
|
-
{ type: saveUserSettings.pending.type },
|
|
626
|
-
{ type: getUserSettings.pending.type },
|
|
627
|
-
{ type: actions.setUserSettings.type, payload: { ...defaultState.users.userSettings } },
|
|
628
|
-
{ type: getUserSettings.fulfilled.type },
|
|
629
|
-
{ type: actions.setUserSettings.type, payload: { ...defaultState.users.userSettings } },
|
|
630
|
-
{ type: saveUserSettings.fulfilled.type },
|
|
631
|
-
{ type: setTooltipReadState.fulfilled.type }
|
|
632
|
-
];
|
|
633
|
-
await store.dispatch(setTooltipReadState({ id: 'foo', readState: 'testRead', persist: true }));
|
|
634
|
-
const storeActions = store.getActions();
|
|
635
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
636
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
637
|
-
});
|
|
638
|
-
it('should handle setting tooltip read state for all tips', async () => {
|
|
639
|
-
const store = mockStore({ ...defaultState });
|
|
640
|
-
|
|
641
|
-
const expectedActions = [
|
|
642
|
-
{ type: setAllTooltipsReadState.pending.type },
|
|
643
|
-
{
|
|
644
|
-
type: actions.setTooltipsState.type,
|
|
645
|
-
payload: { ...Object.values(HELPTOOLTIPS).reduce((accu, { id }) => ({ ...accu, [id]: { readState: 'testRead' } }), {}) }
|
|
646
|
-
},
|
|
647
|
-
{ type: saveUserSettings.pending.type },
|
|
648
|
-
{ type: getUserSettings.pending.type },
|
|
649
|
-
{ type: actions.setUserSettings.type, payload: { ...defaultState.users.userSettings } },
|
|
650
|
-
{ type: getUserSettings.fulfilled.type },
|
|
651
|
-
{ type: actions.setUserSettings.type, payload: { ...defaultState.users.userSettings } },
|
|
652
|
-
{ type: saveUserSettings.fulfilled.type },
|
|
653
|
-
{ type: setAllTooltipsReadState.fulfilled.type }
|
|
654
|
-
];
|
|
655
|
-
await store.dispatch(setAllTooltipsReadState('testRead'));
|
|
656
|
-
const storeActions = store.getActions();
|
|
657
|
-
expect(storeActions.length).toEqual(expectedActions.length);
|
|
658
|
-
expectedActions.map((action, index) => expect(storeActions[index]).toMatchObject(action));
|
|
659
|
-
});
|
|
660
|
-
});
|