add unit test for edit function