Skip to content

Commit

Permalink
test: update integrated swap tests to select a different token
Browse files Browse the repository at this point in the history
  • Loading branch information
gleiser-oliveira committed Mar 13, 2024
1 parent dd23201 commit 2a0d2e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,19 @@ describe('RepayForm - Feature flag enabled: integratedSwap', () => {
isLoading: false,
}));

const { getByTestId, getByText } = renderComponent(
const { getByTestId, getByText, container } = renderComponent(
<Repay asset={fakeAsset} pool={fakePool} onCloseModal={noop} />,
{
accountAddress: fakeAccountAddress,
},
);

selectToken({
container,
selectTokenTextFieldTestId: TEST_IDS.selectTokenTextField,
token: busd,
});

const selectTokenTextField = getByTestId(
getTokenTextFieldTestId({
parentTestId: TEST_IDS.selectTokenTextField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ vi.mock('hooks/useGetSwapRouterContractAddress');

describe('hooks/useSupplyWithdrawModal/Supply - Feature flag enabled: integratedSwap', () => {
beforeEach(() => {
(useIsFeatureEnabled as Vi.Mock).mockImplementation(
({ name }: UseIsFeatureEnabled) => name === 'integratedSwap',
);
(useIsFeatureEnabled as Vi.Mock).mockImplementation(({ name }: UseIsFeatureEnabled) => {
console.log('powerslave222', name);
return name === 'integratedSwap';
});

(useGetSwapInfo as Vi.Mock).mockImplementation(() => ({
swap: undefined,
Expand Down Expand Up @@ -192,13 +193,19 @@ describe('hooks/useSupplyWithdrawModal/Supply - Feature flag enabled: integrated
isLoading: false,
}));

const { getByTestId, getByText } = renderComponent(
const { getByTestId, getByText, container } = renderComponent(
<Supply asset={fakeAsset} pool={fakePool} onCloseModal={noop} />,
{
accountAddress: fakeAccountAddress,
},
);

selectToken({
container,
selectTokenTextFieldTestId: TEST_IDS.selectTokenTextField,
token: busd,
});

const selectTokenTextField = getByTestId(
getTokenTextFieldTestId({
parentTestId: TEST_IDS.selectTokenTextField,
Expand Down

0 comments on commit 2a0d2e1

Please sign in to comment.