Skip to content

Conversation

KrumTy
Copy link
Collaborator

@KrumTy KrumTy commented Aug 6, 2025

Description

Issue: In jest ui unit tests we use configureMockStore instead of the real Redux store. The mock store doesn't actually use the reducers - it just holds state. However, when the test runs, some component or hook is trying to access the actual Redux store configuration, which expects the reducers to be properly defined. Hence we get a lot of errors in the console, that usually happen after a test finishes successfully.

Solution: Use redux store wrapper during unit tests that avoids circular dependencies via dynamic import.

A better solution would require large refactor of the code base.

pd-redis added 30 commits May 7, 2025 12:28
# Conflicts:
#	redisinsight/ui/src/components/connectivity-error/ConnectivityError.tsx
#	redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.tsx
#	redisinsight/ui/src/components/item-list/components/delete-action/DeleteAction.tsx
#	redisinsight/ui/src/components/item-list/components/export-action/ExportAction.tsx
#	redisinsight/ui/src/components/query/query-actions/QueryActions.tsx
#	redisinsight/ui/src/components/query/query-card/QueryCardHeader/QueryCardHeader.tsx
#	redisinsight/ui/src/components/side-panels/panels/enablement-area/EnablementArea/components/InternalPage/InternalPage.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeyHash/AddKeyHash.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeyList/AddKeyList.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeyReJSON/AddKeyReJSON.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeySet/AddKeySet.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeyStream/AddKeyStream.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeyString/AddKeyString.tsx
#	redisinsight/ui/src/pages/browser/components/add-key/AddKeyZset/AddKeyZset.tsx
#	redisinsight/ui/src/pages/browser/modules/key-details/components/rejson-details/components/edit-entire-item-action/EditEntireItemAction.tsx
#	redisinsight/ui/src/pages/browser/modules/key-details/components/set-details/add-set-members/AddSetMembers.tsx
#	redisinsight/ui/src/pages/database-analysis/components/header/Header.tsx
#	redisinsight/ui/src/pages/home/components/database-list-header/DatabaseListHeader.tsx
#	redisinsight/ui/src/pages/home/components/database-manage-tags-modal/ManageTagsModal.tsx
#	redisinsight/ui/src/pages/settings/components/cloud-settings/CloudSettings.tsx
#	redisinsight/ui/src/pages/settings/components/cloud-settings/components/user-api-keys-table/UserApiKeysTable.tsx
#	redisinsight/ui/src/pages/slow-log/components/Actions/Actions.tsx
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Code Coverage - Integration Tests

Status Category Percentage Covered / Total
🟢 Statements 81.72% 16214/19839
🟡 Branches 64.79% 7308/11279
🟡 Functions 70.77% 2279/3220
🟢 Lines 81.37% 15252/18744

Copy link
Contributor

github-actions bot commented Aug 6, 2025

Code Coverage - Backend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 92.34% 13773/14916
🟡 Branches 74% 4144/5600
🟢 Functions 85.85% 2123/2473
🟢 Lines 92.13% 13166/14291

Test suite run success

2940 tests passing in 286 suites.

Report generated by 🧪jest coverage report action from 82adae0

Copy link
Contributor

github-actions bot commented Aug 6, 2025

Code Coverage - Frontend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 81.44% 19006/23336
🟡 Branches 66.77% 8300/12430
🟡 Functions 75.27% 4974/6608
🟢 Lines 81.86% 18602/22725

Test suite run success

4826 tests passing in 634 suites.

Report generated by 🧪jest coverage report action from 82adae0

valkirilov
valkirilov previously approved these changes Aug 6, 2025
valkirilov
valkirilov previously approved these changes Aug 6, 2025
csrf: cloneDeep(initialStateAppCsrfReducer),
init: cloneDeep(initialStateAppInit),
connectivity: cloneDeep(initialStateAppConnectivity),
dbSettings: cloneDeep(initialStateAppDbSettings),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I forgot that this one was missing. Kudos for resolving it 👌

@KrumTy KrumTy changed the title fix: resolve redux store circular dependencies [RI-7280] resolve redux store circular dependencies during tests Aug 6, 2025
valkirilov
valkirilov previously approved these changes Aug 6, 2025
pawelangelow
pawelangelow previously approved these changes Aug 6, 2025
@KrumTy KrumTy changed the base branch from fe/feature/RI-7039-replace-eui to main August 6, 2025 14:52
@KrumTy KrumTy dismissed stale reviews from pawelangelow and valkirilov August 6, 2025 14:52

The base branch was changed.

@KrumTy KrumTy merged commit 86440a9 into main Aug 7, 2025
5 checks passed
@KrumTy KrumTy deleted the bugfix/redux-store-circular-dependencies branch August 7, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants