refactors image state tests, reduces loc