How to ensure an isolated testing environment if the call to the tested class is in the same file as the class body?
I would like to write unit tests (JavaScript, Jest) for my class, but I don’t understand something. When writing a test, I need to import a class file into the test. But import calls the entire file. So, if I had a class call with the original data in the imported file, the class with the original data would be called first, and next with the test data.
How to ensure an isolated testing environment if the call to the tested class is in the same file as the class body?
I would like to write unit tests (JavaScript, Jest) for my class, but I don’t understand something. When writing a test, I need to import a class file into the test. But import calls the entire file. So, if I had a class call with the original data in the imported file, the class with the original data would be called first, and next with the test data.