Skip to content

Commit

Permalink
chore: fixed orders failing test case (#9735)
Browse files Browse the repository at this point in the history
  • Loading branch information
ameerul-deriv committed Aug 17, 2023
1 parent 736c061 commit 7885480
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions packages/p2p/src/components/orders/__test__/orders.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ import { useStores } from 'Stores';
import { useSafeState } from '@deriv/components';
import Orders from '../orders.jsx';

const mock_store = {
general_store: {
active_index: 2,
setActiveIndex: jest.fn(),
},
order_store: {
order_id: null,
order_information: '',
orders: [],
onOrderIdUpdate: jest.fn(),
onOrdersUpdate: jest.fn(),
onUnmount: jest.fn(),
setForceRerenderOrders: jest.fn(),
},
};

jest.mock('Stores', () => ({
...jest.requireActual('Stores'),

useStores: jest.fn().mockReturnValue({
order_store: {
order_id: null,
onOrderIdUpdate: jest.fn(),
orders: [],
onOrdersUpdate: jest.fn(),
onUnmount: jest.fn(),
setForceRerenderOrders: jest.fn(),
},
}),
useStores: jest.fn(() => mock_store),
}));

jest.mock('@deriv/components', () => ({
Expand Down Expand Up @@ -46,17 +52,8 @@ describe('<Orders/>', () => {
});

it('should display the order details for a particular ', () => {
useStores.mockImplementation(() => ({
order_store: {
order_id: null,
onOrderIdUpdate: jest.fn(),
orders: [],
onOrdersUpdate: jest.fn(),
onUnmount: jest.fn(),
setForceRerenderOrders: jest.fn(),
order_information: 'test',
},
}));
mock_store.order_store.order_information = 'test';

render(<Orders />);

expect(screen.getByText('Order Details')).toBeInTheDocument();
Expand Down

1 comment on commit 7885480

@vercel
Copy link

@vercel vercel bot commented on 7885480 Aug 17, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
deriv-app.binary.sx
deriv-app-git-master.binary.sx
binary.sx

Please sign in to comment.