writing lib/Api tests