duplicate code ... create a test function for commands