Skip to content
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

Create test suite #677

Merged
merged 3 commits into from
Sep 30, 2019
Merged

Create test suite #677

merged 3 commits into from
Sep 30, 2019

Conversation

vweevers
Copy link
Member

Closes #273. Doesn't fully achieve what that ticket describes (being able to call the test suite externally would require moving devDependencies to dependencies, or moving the whole thing to its own module), but there's no use case for that anymore. So, this PR is more about being able to reuse the test suite internally. This allows us to test feature parity between levelup and abstract-leveldown (Level/community#58).

@vweevers vweevers added semver-patch Bug fixes that are backward compatible test Improvements or additions to tests labels Sep 22, 2019

stderrMock.expects('error').never()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides this not actually working anymore (because node emits a warning event rather than error), it caused problems when calling the test multiple times: sinon complained console was already wrapped.

// TODO to make this pass:
// - Have abstract-leveldown use level-errors
// - Perform type checks in same order (e.g. check key before callback)
// - Add db.isClosed(), isOpen() to abstract-leveldown
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doable, I think 😃

options = xtend(options, {
keyAsBuffer: false,
valueAsBuffer: false
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests implicitly relied on the default utf8 encoding, for the db to return strings. When the db isn't wrapped with encoding-down, *asBuffer: false achieves the same.

@vweevers
Copy link
Member Author

Travis error:

The job exceeded the maximum log length, and has been terminated.

That's new..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch Bug fixes that are backward compatible test Improvements or additions to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

convert tests into an abstract test suite module that other levelups can use
2 participants