Improve test for manageImages to handle async nature correctly