Move some tests into unit tests