server: add unit tests

Make test coverage >= 90%

#1019 
we do not need to test context pkg.