[Docs] Show examples of unit testing with Drivine
See original GitHub issueIt would be great to have some documentation available to show how to unit test with Drivine. The docs show how to perform end2end tests. It does not show how to get the injected PersistenceManager
from the testing module, provide mock implementations, or spy on its methods.
An option would be to automatically mock the entire Drivine module: jest.mock("@liberation-data/drivine")
, but this causes very vague errors regarding decorators.
How would we go about this?
Issue Analytics
- State:
- Created a year ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Best practices for writing unit tests - .NET - Microsoft Learn
Learn best practices for writing unit tests that drive code quality and resilience for .NET Core and .NET Standard projects.
Read more >Getting Started: Writing your Unit Test using TestDriver
In this section we will explain how to use ravendb-test-driver in order to write unit tests for working with RavenDB. TestDriver uses an...
Read more >Unit tests: Mock driver - NAPALM's documentation!
Unit tests : Mock driver¶. A mock driver is a software that imitates the response pattern of another system. It is meant to...
Read more >unittest — Unit testing framework — Python 3.11.1 ...
The above examples show the most commonly used unittest features which are sufficient to meet many everyday testing needs.
Read more >Test-driven development | IntelliJ IDEA Documentation
... and run unit tests. In this tutorial we're going to show how to use IntelliJ IDEA to write tests first (Test Driven...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes it depends what you’re looking for, but its very cool when it matches.
I plan to add GraphQL features to Drivine in future. (Will work with any cypher compatible graphDB).
Looking at the repositories (which is what I call services), you don’t unit test them. You (as you mentioned) integration test them (sort of, there is no asserting in the sample repository). How do you know the database has been called with the correct arguments? Transform it to the correct results (e.g. when using
map
)? How do you verify the repository works as expected when the database connection fails?