File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
src/lib/pages/frontsite/SelfCheckout/state Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const notifyResultMessage = (message) => {
2222
2323const searchItem = async ( dispatch , term ) => {
2424 const response = await itemApi . list ( itemApi . query ( ) . withBarcode ( term ) . qs ( ) ) ;
25- const item = _first ( response . data . hits ) ;
25+ const item = _first ( response . data . hits ) || { } ;
2626
2727 dispatch ( {
2828 type : SEARCH_ITEM_SUCCESS ,
Original file line number Diff line number Diff line change @@ -7,23 +7,23 @@ import { itemApi } from '@api/items';
77const middlewares = [ thunk ] ;
88const mockStore = configureMockStore ( middlewares ) ;
99
10- const mockGet = jest . fn ( ) ;
11- itemApi . get = mockGet ;
10+ const mockList = jest . fn ( ) ;
11+ itemApi . list = mockList ;
1212
1313const response = { data : { } } ;
1414const expectedPayload = { } ;
1515
1616let store ;
1717beforeEach ( ( ) => {
18- mockGet . mockClear ( ) ;
18+ mockList . mockClear ( ) ;
1919
2020 store = mockStore ( initialState ) ;
2121 store . clearActions ( ) ;
2222} ) ;
2323
2424describe ( 'SelfCheck Out test' , ( ) => {
2525 it ( 'should dispatch an action updating the payloadresult item' , async ( ) => {
26- mockGet . mockResolvedValue ( response ) ;
26+ mockList . mockResolvedValue ( response ) ;
2727
2828 const expectedAction1 = {
2929 type : actions . SEARCH_IS_LOADING ,
You can’t perform that action at this time.
0 commit comments