Refactored to use clearCookie method
Removed unnecessary urlencoded middleware from test
Added configuration validation function with a self defining function