Unit test environment - jasmine
zoran995 opened this issue · comments
There are some issues with the current testing approach applied to terriajs project, making tests both fragile and hard to write
- using an outdated testing library,
jasmine
latest release is 5.1 while terriajs is using 2.9. It becomes pretty hard to find proper documentation and solutions to issues that arise while writing tests. - having API requests in tests, currently, there are over 60 requests to the external API systems which is pretty bad IMHO. Those request also slows down running the unit tests, and I am pretty sure those can be blocked with proper mocking and early return, or replaced with local data load requests.
- not using a modern testing library made for testing react, yeah
react-test-renderer
provides some features but it is forcing usage of dom API and parsing of react tree to find simple stuff making tests pretty fragile. i.e. searching for a rendered string, a developer will have to find an element in a dom tree (maybe even traverse through its children) and check the proper content, any future change to the tested part of code will break the used code.