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

Rewrite buster tests as tape tests #674

Merged
merged 22 commits into from
Sep 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
test
buster.js
.airtap.yml
.travis.yml
.dntrc
Expand Down
7 changes: 0 additions & 7 deletions buster.js

This file was deleted.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"test-browsers": "airtap --loopback airtap.local test/index.js",
"test-browser-local": "airtap --local test/index.js",
"hallmark": "hallmark --fix",
"dependency-check": "dependency-check . buster.js test/*.js",
"dependency-check": "dependency-check . test/*.js",
"prepublishOnly": "npm run dependency-check"
},
"dependencies": {
"deferred-leveldown": "~5.2.0",
"deferred-leveldown": "~5.2.1",
"level-errors": "~2.0.0",
"level-iterator-stream": "~4.0.0",
"xtend": "~4.0.0"
Expand All @@ -23,9 +23,7 @@
"after": "^0.8.2",
"airtap": "^2.0.0",
"async-each": "^1.0.3",
"bl": "^3.0.0",
"browserify": "^16.0.0",
"bustermove": "^1.0.0",
"concat-stream": "^2.0.0",
"coveralls": "^3.0.2",
"delayed": "^2.0.0",
Expand All @@ -38,10 +36,11 @@
"memdown": "^5.0.0",
"nyc": "^14.0.0",
"pinkie": "^2.0.4",
"referee": "^1.2.0",
"run-parallel": "^1.1.9",
"run-series": "^1.1.8",
"safe-buffer": "^5.1.0",
"simple-concat": "^1.0.0",
"sinon": "^7.4.2",
"standard": "^14.1.0",
"tape": "^4.7.0",
"trickle": "0.0.2"
Expand Down
98 changes: 37 additions & 61 deletions test/argument-checking-test.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,37 @@
var common = require('./common')
var assert = require('referee').assert
var buster = require('bustermove')

buster.testCase('Argument checking', {
setUp: common.commonSetUp,
tearDown: common.commonTearDown,

'test get() throwables': function (done) {
this.openTestDatabase(function (db) {
assert.exception(
db.get.bind(db),
{ name: 'ReadError', message: 'get() requires a key argument' },
'no-arg get() throws'
)
done()
})
},

'test put() throwables': function (done) {
this.openTestDatabase(function (db) {
assert.exception(
db.put.bind(db),
{ name: 'WriteError', message: 'put() requires a key argument' },
'no-arg put() throws'
)

done()
})
},

'test del() throwables': function (done) {
this.openTestDatabase(function (db) {
assert.exception(
db.del.bind(db),
{ name: 'WriteError', message: 'del() requires a key argument' },
'no-arg del() throws'
)

done()
})
},

'test batch() throwables': function (done) {
this.openTestDatabase(function (db) {
assert.exception(
db.batch.bind(db, null, {}),
{ name: 'WriteError', message: 'batch() requires an array argument' },
'no-arg batch() throws'
)

assert.exception(
db.batch.bind(db, {}),
{ name: 'WriteError', message: 'batch() requires an array argument' },
'1-arg, no Array batch() throws'
)

done()
})
}
})
module.exports = function (test, testCommon) {
test('argument checking', function (t) {
var db = testCommon.factory()

t.throws(
db.get.bind(db),
/^ReadError: get\(\) requires a key argument$/,
'no-arg get() throws'
)

t.throws(
db.put.bind(db),
/^WriteError: put\(\) requires a key argument$/,
'no-arg put() throws'
)

t.throws(
db.del.bind(db),
/^WriteError: del\(\) requires a key argument$/,
'no-arg del() throws'
)

t.throws(
db.batch.bind(db, null, {}),
/^WriteError: batch\(\) requires an array argument$/,
'null-arg batch() throws'
)

t.throws(
db.batch.bind(db, {}),
/^WriteError: batch\(\) requires an array argument$/,
'1-arg, no array batch() throws'
)

db.close(t.end.bind(t))
})
}
Loading