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

Commit 91ff0e7

Browse files
authored
Merge pull request #674 from Level/rewrite-tests
Rewrite buster tests as tape tests
2 parents b0bf86d + 5fc3b30 commit 91ff0e7

30 files changed

+1838
-2155
lines changed

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
test
2-
buster.js
32
.airtap.yml
43
.travis.yml
54
.dntrc

buster.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"test-browsers": "airtap --loopback airtap.local test/index.js",
1111
"test-browser-local": "airtap --local test/index.js",
1212
"hallmark": "hallmark --fix",
13-
"dependency-check": "dependency-check . buster.js test/*.js",
13+
"dependency-check": "dependency-check . test/*.js",
1414
"prepublishOnly": "npm run dependency-check"
1515
},
1616
"dependencies": {
17-
"deferred-leveldown": "~5.2.0",
17+
"deferred-leveldown": "~5.2.1",
1818
"level-errors": "~2.0.0",
1919
"level-iterator-stream": "~4.0.0",
2020
"xtend": "~4.0.0"
@@ -23,9 +23,7 @@
2323
"after": "^0.8.2",
2424
"airtap": "^2.0.0",
2525
"async-each": "^1.0.3",
26-
"bl": "^3.0.0",
2726
"browserify": "^16.0.0",
28-
"bustermove": "^1.0.0",
2927
"concat-stream": "^2.0.0",
3028
"coveralls": "^3.0.2",
3129
"delayed": "^2.0.0",
@@ -38,10 +36,11 @@
3836
"memdown": "^5.0.0",
3937
"nyc": "^14.0.0",
4038
"pinkie": "^2.0.4",
41-
"referee": "^1.2.0",
4239
"run-parallel": "^1.1.9",
4340
"run-series": "^1.1.8",
4441
"safe-buffer": "^5.1.0",
42+
"simple-concat": "^1.0.0",
43+
"sinon": "^7.4.2",
4544
"standard": "^14.1.0",
4645
"tape": "^4.7.0",
4746
"trickle": "0.0.2"

test/argument-checking-test.js

Lines changed: 37 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,37 @@
1-
var common = require('./common')
2-
var assert = require('referee').assert
3-
var buster = require('bustermove')
4-
5-
buster.testCase('Argument checking', {
6-
setUp: common.commonSetUp,
7-
tearDown: common.commonTearDown,
8-
9-
'test get() throwables': function (done) {
10-
this.openTestDatabase(function (db) {
11-
assert.exception(
12-
db.get.bind(db),
13-
{ name: 'ReadError', message: 'get() requires a key argument' },
14-
'no-arg get() throws'
15-
)
16-
done()
17-
})
18-
},
19-
20-
'test put() throwables': function (done) {
21-
this.openTestDatabase(function (db) {
22-
assert.exception(
23-
db.put.bind(db),
24-
{ name: 'WriteError', message: 'put() requires a key argument' },
25-
'no-arg put() throws'
26-
)
27-
28-
done()
29-
})
30-
},
31-
32-
'test del() throwables': function (done) {
33-
this.openTestDatabase(function (db) {
34-
assert.exception(
35-
db.del.bind(db),
36-
{ name: 'WriteError', message: 'del() requires a key argument' },
37-
'no-arg del() throws'
38-
)
39-
40-
done()
41-
})
42-
},
43-
44-
'test batch() throwables': function (done) {
45-
this.openTestDatabase(function (db) {
46-
assert.exception(
47-
db.batch.bind(db, null, {}),
48-
{ name: 'WriteError', message: 'batch() requires an array argument' },
49-
'no-arg batch() throws'
50-
)
51-
52-
assert.exception(
53-
db.batch.bind(db, {}),
54-
{ name: 'WriteError', message: 'batch() requires an array argument' },
55-
'1-arg, no Array batch() throws'
56-
)
57-
58-
done()
59-
})
60-
}
61-
})
1+
module.exports = function (test, testCommon) {
2+
test('argument checking', function (t) {
3+
var db = testCommon.factory()
4+
5+
t.throws(
6+
db.get.bind(db),
7+
/^ReadError: get\(\) requires a key argument$/,
8+
'no-arg get() throws'
9+
)
10+
11+
t.throws(
12+
db.put.bind(db),
13+
/^WriteError: put\(\) requires a key argument$/,
14+
'no-arg put() throws'
15+
)
16+
17+
t.throws(
18+
db.del.bind(db),
19+
/^WriteError: del\(\) requires a key argument$/,
20+
'no-arg del() throws'
21+
)
22+
23+
t.throws(
24+
db.batch.bind(db, null, {}),
25+
/^WriteError: batch\(\) requires an array argument$/,
26+
'null-arg batch() throws'
27+
)
28+
29+
t.throws(
30+
db.batch.bind(db, {}),
31+
/^WriteError: batch\(\) requires an array argument$/,
32+
'1-arg, no array batch() throws'
33+
)
34+
35+
db.close(t.end.bind(t))
36+
})
37+
}

0 commit comments

Comments
 (0)