unit test for api