ip_email_record tests

There's a lot of duplicated code between `email_record.js`, `ip_record.js` and `ip_email_record.js` which should be refactored, but I figured adding tests first would be helpful.