Functional tests to unit tests