equinor / fmu-editor

5 stars 2 forks source link

Refresh jest, add tests #67

Closed mferrera closed 1 year ago

mferrera commented 1 year ago

This PR refreshes jest for unit testing. The intent was also to set up Cypress for component/e2e testing, but this does not seem possible as Cypress does not support Electron apps. It includes some changes to the mathematical portions recently added. The intent is that we can now simply add unit tests for code we touch going forward.

A few workarounds were tried; the Electron app is just a React app, after all. But integration with the filesystem is deeply embedded into the app, given its nature of course, and even trying to Render the React portion to a web bundle with some mocked/patched filesystem functions couldn't quite work correctly.

Playwright offers experimental Electron testing support, but despite being a Microsoft package itself even VSCode does not use it. VSCode uses a customized UI testing framework they call Smoketest.

It may be fruitful is revisit this once we have a parallel web app going.