@thelastpsion my 2 cents:
If it’s tightly coupled to the structure of the class or breaks the class’s encapsulation somehow, it goes on the class
Otherwise, if you’re using a language that allows you to control what functions are exported separately from what class members are exported, then it depends on the tradeoff between easy testing and a clean interface.
If it’s a private method then it’s generally best to not unit test it directly (in a perfect world). If it’s a separate function then that’s much easier to unit test.
If there’s no way to make it clear to consumers of your module that this code is supposed to be internal, then moving it out of the class increases the chances of people depending on it when you don’t want them to, or it can make your interfaces more cluttered.
Once you have unit tests for the thing, it will want to settle towards where you’ve put it. So if you could see this function one day becoming part of its own class, I would lean towards extracting and testing it separately early.