Added unit and integration tests for the file.replace functions