code do with its tests and the person who read it will get confused, I thought may there be an standard.
may a better question be: should I put API and _foo() test in same file or test it in separate file?
No need. Ideally the tests for all code in a source file are located together. All testing code looks similar and follow the AAA pattern. So reading and understanding regular code is not the same as reading and understanding test code. Test code is more easier to read. So you don't have to go out the way to make it more easier for developers by trying to organize your test code. As long as you follow certain naming conventions for your test code, people should be able to easily find the test code for some code and go through it irrespective of whether it is surrounded by other test code.
Обсуждают сегодня