|
@@ -0,0 +1,50 @@
|
|
|
+// import { configureStore } from '@reduxjs/toolkit';
|
|
|
+// import businessFlowMiddleware from './businessFlowMiddleware';
|
|
|
+// import leavingRegisterMonitor from './leavingRegisterMonitor';
|
|
|
+// import BusinessFlowReducer, { setBusinessFlow } from './BusinessFlowSlice';
|
|
|
+// import viewSelectionReducer, { setAvailableViews, setProtocols } from './patient/viewSelection';
|
|
|
+
|
|
|
+// const store = configureStore({
|
|
|
+// reducer: {
|
|
|
+// BusinessFlow: BusinessFlowReducer,
|
|
|
+// viewSelection: viewSelectionReducer,
|
|
|
+// },
|
|
|
+// middleware: (getDefaultMiddleware) =>
|
|
|
+// getDefaultMiddleware().concat(
|
|
|
+// businessFlowMiddleware,
|
|
|
+// leavingRegisterMonitor
|
|
|
+// ),
|
|
|
+// });
|
|
|
+
|
|
|
+// describe('leavingRegisterMonitor middleware', () => {
|
|
|
+// beforeEach(() => {
|
|
|
+// store.dispatch(setBusinessFlow('register'));
|
|
|
+// store.dispatch(setAvailableViews([{ id: 1, name: 'View1' }]));
|
|
|
+// store.dispatch(setProtocols([{ id: 1, name: 'Protocol1' }]));
|
|
|
+// });
|
|
|
+
|
|
|
+// it('should clear selectedViews and availableViews when transitioning from register to worklist', () => {
|
|
|
+// store.dispatch(setBusinessFlow('worklist'));
|
|
|
+// const state = store.getState();
|
|
|
+// expect(state.viewSelection.selectedViews).toEqual([]);
|
|
|
+// expect(state.viewSelection.availableViews).toEqual([]);
|
|
|
+// expect(state.viewSelection.protocols).toEqual([]);
|
|
|
+// });
|
|
|
+
|
|
|
+// it('should clear selectedViews and availableViews when transitioning from register to exam', () => {
|
|
|
+// store.dispatch(setBusinessFlow('exam'));
|
|
|
+// const state = store.getState();
|
|
|
+// expect(state.viewSelection.selectedViews).toEqual([]);
|
|
|
+// expect(state.viewSelection.availableViews).toEqual([]);
|
|
|
+// expect(state.viewSelection.protocols).toEqual([]);
|
|
|
+// });
|
|
|
+
|
|
|
+// it('should not clear selectedViews and availableViews when transitioning from worklist to exam', () => {
|
|
|
+// store.dispatch(setBusinessFlow('worklist'));
|
|
|
+// store.dispatch(setBusinessFlow('exam'));
|
|
|
+// const state = store.getState();
|
|
|
+// expect(state.viewSelection.selectedViews).toEqual([]);
|
|
|
+// expect(state.viewSelection.availableViews).toEqual([]);
|
|
|
+// expect(state.viewSelection.protocols).toEqual([]);
|
|
|
+// });
|
|
|
+// });
|