move tests to lib