Sometimes the Idea was a good idea, but it didn't pan out in the end, and that's ok, just delete the code.
Sometimes the Idea was a good idea, and while it didn't pan out at the time, it still might in the future, but the code is really bad code, and that's ok, just delete the code.
Sometimes the developers who wrote the code were simply untrained, inexperienced, or both, and that's ok, just delete their code.
Most times, if you've added tests, you'll have added more code to the repository than you deleted, and that's ok, just add the tests and delete the code.
...to be continued (maybe)
Sometimes the Idea was a good idea, and while it didn't pan out at the time, it still might in the future, but the code is really bad code, and that's ok, just delete the code.
Sometimes the developers who wrote the code were simply untrained, inexperienced, or both, and that's ok, just delete their code.
Most times, if you've added tests, you'll have added more code to the repository than you deleted, and that's ok, just add the tests and delete the code.
...to be continued (maybe)
Can you expand on this? Do you mean that you are adding tests to the underlying code? That's how i read this, but then got confused by the final part that says ... and delete the code