server: add unit tests

Make test coverage >= 90%

#1019 
can you move this test to the bottom of the test file?