Code tidy as per feedback from PR

Broke out cookie test module into its own file and rewrote test into
Given When format.