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.

Consider a factory pattern in test suite

See original GitHub issue

Where testCommon.factory() would return a fresh db. This allows implementations to add options to their constructor, if they need to. See https://github.com/andrewosh/hyperdown/issues/2 for background.

@andrewosh @ralphtheninja @juliangruber

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
vweeverscommented, May 28, 2018

Not yet, there are a lot of angles to consider (and we’re currently working on other stuff).

As a temporary solution, you might be able to pass a wrapper to the abstract tests. Along the lines of

require('abstract-leveldown/abstract/get-test').all(wrapper, test)

function wrapper (location) {
  hyperdown.call(this, location, {
    reduce: (a, b) => {
      if (!a) return b
      return a
    }
  }
}

util.inherits(wrapper, hyperdown)
0reactions
andrewoshcommented, May 29, 2018

Thanks a bunch! I’ll give that a shot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Factory Pattern For Test Automation | by Lakmali Bandara
In the Factory pattern, we create an object without exposing the creation logic to the client and refer to the newly created object...
Read more >
Builder Factory Pattern for Testing – Evolve Your Code ...
The builder factory pattern helps ensure that writing and maintaining tests is easier than manual testing. See how we leveraged it.
Read more >
Chapter-12: Test Automation Design patterns you should know
2) Factory Design Pattern:​​ It is often used when a class cannot anticipate the type of objects it needs to create beforehand. Here,...
Read more >
Working With Design Patterns: Factory Method - Developer.com
The benefit of a factory method is that it allows code in an abstract class defer object creation to subclasses. As each concrete...
Read more >
Chapter 14. Testing design patterns - JUnit Recipes
The Decorator and Abstract Factory patterns each provide an opportunity to see abstract test cases in action. While we cannot possibly treat all...
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