Refactor to BrowserClient. Unify tests with spies and fakes #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I refactored the
OcrdBrowser
s to use the interface described in #14This refactoring provided enough encapsulation to allow me to refactor the tests for the workspace endpoint to work with both
BrowserSpy
s (an in-memory test double) andBrowserFake
s (an actual server running as a background process) without further modification.This might open the door to future tests with an actual
broadway
daemon in the background as an acceptance test.Whenever a test is running with a
BrowserFake
it is automatically marked as an integration test.Therefore, running the tests with
not integration
is significantly faster now and allows for faster iteration.For users of
pdm
, like myself, I have added extra script commands topyproject.toml
to either run only unit or both unit and integration tests.Unit tests only:
pdm run test
Unit and integration tests:
pdm run test-integration