You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe('LosingOrdersViewsBanner',()=>{it('should render the banner with the correct message for the orders subtab',()=>{vi.mock('@store/actionCreators/IPPHooks/useIPPTabCount',()=>({default: vi.fn().mockReturnValue({subtab: 'lorders'}),}));render(<LosingOrdersViewsBanner/>);
expect(screen.getByText(LOSING_BANNER_TEXTS.LOSING_ORDERS)).toBeInTheDocument();});it('should render the banner with the correct message for the views subtab',async()=>{vi.mock('@store/actionCreators/IPPHooks/useIPPTabCount',()=>({default: vi.fn().mockReturnValue({subtab: 'lviews'}),}));render(<LosingOrdersViewsBanner/>);
expect(screen.getByText(LOSING_BANNER_TEXTS.LOSING_VIEWS)).toBeInTheDocument();});});
I am trying to get different values from a mock for two different test cases.
my component is using the value of subtab from hook useIPPTabCount const { subtab } = useIPPTabCount();
now for my first test case, I want the value of the subtab to be lorders and lviews for the second and maybe so on for further test cases but in vitest once I mock the module, it returns the same value for each test case.
Describe the bug
Here's my react component
Test File
I am trying to get different values from a mock for two different test cases.
my component is using the value of subtab from hook useIPPTabCount
const { subtab } = useIPPTabCount();
now for my first test case, I want the value of the subtab to be
lorders
andlviews
for the second and maybe so on for further test cases but in vitest once I mock the module, it returns the same value for each test case.Reproduction
NA
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: