Our great sponsors
-
Playwright
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
abstract-blob-store
A test suite and interface you can use to implement streaming file (blob) storage modules for various storage backends and platforms
Checkout https://playwright.dev
Hmm, I'm not sure I follow the part of static imports, but I tend to only mock code that perform side effects (usually, HTTP requests), and I explicitly isolate those to separate modules that I can mock. Other than that, they're more integration tests using testing-library [1] to simulate user interactions and verifying that they have the expected effects.
When there's complex business logic, I'll separate that out into a separate pure function, and I write tests for that function without needing mocks.
[1] https://testing-library.com/
One approach I’ve found useful is publishing a test suite as a module for use in these kind of “fakes”. For example, a file system blob store that passes the same test suite as an S3 blob store can be used as a reliable fake.
https://github.com/maxogden/abstract-blob-store