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

Commit 18e1fd1

Browse files
committed
Add abstract-leveldown test suite
This works thanks to the `encodings` option that was added to the test suite (originally for `levelup` compatibility testing) and changes the expected outputs (from buffers by default to strings by default).
1 parent b1b7306 commit 18e1fd1

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,32 @@
22

33
const test = require('tape')
44
const encdown = require('..')
5+
const suite = require('abstract-leveldown/test')
56
const memdown = require('memdown')
67
const Buffer = require('buffer').Buffer
78
const hasOwnProperty = Object.prototype.hasOwnProperty
89
const noop = function () {}
910

11+
const testCommon = suite.common({
12+
test: test,
13+
factory: function () {
14+
return encdown(memdown())
15+
},
16+
17+
encodings: true,
18+
19+
// Unsupported features
20+
createIfMissing: false,
21+
errorIfExists: false,
22+
23+
// Opt-in to new tests
24+
clear: true
25+
})
26+
27+
// Test abstract-leveldown compliance
28+
suite(testCommon)
29+
30+
// Custom tests
1031
test('opens and closes the underlying db', function (t) {
1132
const _db = {
1233
open: function (opts, cb) {

0 commit comments

Comments
 (0)