use ternary operator instead of if statement for simple case
fix the tests, make them more realistic, and add a new one for get-cookie functionality