Add test case for removing unused dependencies on whitelisted update

Addresses #3434