Common tests

add tests for all the logic that was moved into common