Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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