server: add unit tests

Make test coverage >= 90%

#1019 
sure. it is good to point out the priority of these two arguments.