port: [test] refactor api