Add unit test for magic