add unit tests for legacy migration