Improve metadata unit tests