added a unit test for isValid