question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Docs] Show examples of unit testing with Drivine

See original GitHub issue

It 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:closed
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jasperbluescommented, Jun 6, 2022

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).

1reaction
NilsMollercommented, Jun 4, 2022

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found