use nock for endpoint unit test