refactor unit tests for fetchImage