Add some unit tests for API