Add tests for factories and compat