@@ -113,9 +113,9 @@ import { useDispatch } from 'react-redux';
113
113
main : {
114
114
port : null ,
115
115
currentTab : 87 , // Update with your desired value
116
- currentTitle : null ,
116
+ currentTitle : 'test string' ,
117
117
tabs : customTabs , // Replace with the actual (testing) tab data
118
- currentTabInApp : null ,
118
+ currentTabInApp : 'test string' ,
119
119
connectionStatus : false ,
120
120
connectRequested : true ,
121
121
} ,
@@ -152,7 +152,7 @@ jest.mock('../components/SwitchApp', () => () => {
152
152
//here we set it as a jest.fn()
153
153
//then we pass it into our actionContainer on render
154
154
const setActionViewMock = jest . fn ( ) ;
155
-
155
+ const toggleActionContainer = jest . fn ( ) ;
156
156
jest . mock ( 'react-redux' , ( ) => ( {
157
157
...jest . requireActual ( 'react-redux' ) , // Use the actual react-redux module except for the functions you want to mock
158
158
useDispatch : jest . fn ( ) , // set up a mock function for useDispatch
@@ -165,7 +165,7 @@ describe('unit testing for ActionContainer', ()=>{
165
165
const dummyDispatch = jest . fn ( ) ; //separate mock function created because we need to explicitly define on line 30 what
166
166
useDispatchMock . mockReturnValue ( dummyDispatch ) ; //exactly useDispatchMock returns (which is a jest.fn())
167
167
beforeEach ( ( ) => {
168
- render ( < ActionContainer actionView = { true } setActionView = { setActionViewMock } /> )
168
+ render ( < ActionContainer actionView = { true } setActionView = { setActionViewMock } toggleActionContainer = { toggleActionContainer } /> )
169
169
} ) ;
170
170
171
171
test ( 'expect top arrow to be rendered' , ( ) => {
@@ -193,14 +193,14 @@ describe('Integration testing for ActionContainer.tsx', () => {
193
193
test ( 'renders the ActionContainer component' , ( ) => {
194
194
//tests that the clearButton is rendered by testing if we can get "Clear"
195
195
//need to set actionView to true to correctly render clearbutton
196
- render ( < ActionContainer setActionView = { setActionViewMock } actionView = { true } /> ) ;
196
+ render ( < ActionContainer setActionView = { setActionViewMock } actionView = { true } toggleActionContainer = { toggleActionContainer } /> ) ;
197
197
const clearButton = screen . getByText ( 'Clear' ) ; // Use an existing element
198
198
expect ( setActionViewMock ) . toHaveBeenCalledWith ( true ) ;
199
199
expect ( clearButton ) . toBeInTheDocument ( ) ;
200
200
} ) ;
201
201
202
202
test ( 'Slider resets on clear button' , ( ) => {
203
- render ( < ActionContainer actionView = { true } setActionView = { setActionViewMock } /> )
203
+ render ( < ActionContainer actionView = { true } setActionView = { setActionViewMock } toggleActionContainer = { toggleActionContainer } /> )
204
204
render ( < TravelContainer snapshotsLength = { 0 } /> )
205
205
fireEvent . click ( screen . getAllByRole ( 'button' ) [ 0 ] ) ;
206
206
expect ( screen . getByRole ( 'slider' ) ) . toHaveStyle ( 'left: 0' ) ;
0 commit comments