I have an application that have no unit tests. There are performed only manual tests through UI clicking. There is also a lot of spaghetti code, runtime evalutions, duck castings, old versions of third party libraries etc. Miraculously, perhaps because after massive manual testing sessions or infallible programmers, the application is working. However now, the new functional requirements have arised. I would like to stop that madness and introduce some refactoring, unit tests, third party libraries updates. The problem is, that if I covered the entire code with unit tests it would take few weeks or months. It is impossible to get so much time. It would be easier if I had some well known proportion that I could adhere to.
Is there a standard algorithm that allows to calculate how much time should be spend on implementing not business value in code versus value visible by business? E.g. 50/50 if there is spagetti code. 25/50 if there are already some tests.