-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mock tests should have inputs configured in the test + one mock API per test #4494
Comments
I just got to work with the codebase, and the tests truly are unmaintainable as they are today. I'll try to move this (the first step #4734) up in priority. |
|
I don't like this global variable for collecting logs. flowcrypt-browser/test/source/test.ts Line 54 in c52ae09
Log lines may get mixed up from various tests running concurrently, right? It's hard to retrieve a test's own context in |
Yeah, it should be useful for tests debugging to separate mock api logs across different tests.
You mean using |
Yes, this would work (I was mistaken in that flowcrypt-browser/test/source/tests/tooling/index.ts Lines 9 to 17 in 442ed6e
instead we should use the |
Sounds good 👍 |
I'm closing this master issue, if anything is still left to do, let's file individual issues. Well done. |
Currently, the test codebase has a single API mock for all tests, and some parts of the mock setup are meant for some tests while other parts for others, in non-obvious ways. The better example is when there is a comment like this:
The worse example is silently implied setup, like certain tests expect client configuration to be set up based on their domain, the example is here:
The mock API endpoints test for certain conditions etc - none of which is obvious from the test.
There's also some that may not apply to this particular test, and may be causing side effects:
But some other test may rely on that, etc.. it really is spaghetti.
I'd like to follow what we do on iOS - one mock API per test, which is configured directly in the test definition with no side effects on other tests. It would look something like this:
The steps would be as follows:
First PR: for each test, we will have to (probably inside
testWithBrowser
):Second wave of PRs: allow local configuration of the mock APIs, but give every test the same configuration:
I would recommend to do this service by service, eg start with only Attester, then FES in another PR, etc.
This way, we ensure that all current schenanigans we do for tests can be configured using the new mechanism. But we don't yet do individual configuration per test, because it's a task on its own to figure out which tests need exactly what configuration.
Third wave of PRs: start dis-entangling the dependencies for each test from the LEGACY_GLOBAL configs:
The text was updated successfully, but these errors were encountered: