# Router Test

One of the first things we need to test is that the Router contact is capable of adding & removing liquidity. This mean checking that Router can handle:

* *AddLiquidity* for token-token pairs
* *AddLiquidity* for ETH pairs
* *RemoveLiquidity* for token-token pairs
* *RemoveLiquidity* for ETH pairs

The add liquidity method needs to be tested in 2 case scenarios. If the pair already exists and if it has not been created yet.&#x20;

We are going to also test if a trade can be done, once we have approved the corresponding ERC20's manipulations and we are going to add liquidity to the following Pairs:

* wETH - Token A&#x20;
* wETH - Token B
* Token A - Token B

After Pairs have been created and liquidity has been added we are going to perform some swaps, concretely:

* ETH --> Token A
* Token A --> Token B

This way we would have tested that swapETHForExactTokens() and swapTokensForExactTokens().

Finally we are going to withdraw 50% of the provided liquidity to wETH - Token A Pair. In order to test if we can remove liquidity.

The script used for testing all those capabilities: *(1)*&#x20;

{% embed url="<https://github.com/rogerCapone/XdYe_Tests/blob/main/Router_AddAndRemoveLiquidity.js>" %}
Script for testing Adding and Removing Liquidity, creating Pair and swapping tokens through Router contract
{% endembed %}
