write tests for isSafe