Skip to content
Browse files

update tests

  • Loading branch information...
1 parent 8d55c53 commit 226360e55fdc16ee068625a2dbc019d86dd7b39f @dominictarr committed
Showing with 18 additions and 7 deletions.
  1. +8 −3 test/open.js
  2. +3 −1 test/open2.js
  3. +3 −1 test/open3.js
  4. +2 −1 test/reopen.js
  5. +2 −1 test/reopen2.js
View
11 test/open.js
@@ -2,6 +2,8 @@
var rimraf = require('rimraf')
var levelup = require('levelup')
+var SubLevel = require('level-sublevel')
+
var Model = require('scuttlebutt/model')
var LevelScuttlebutt = require('..')
var Client = require('../client')
@@ -12,9 +14,12 @@ var tape = require('tape')
tape('local open, remote open', function (t) {
var path = '/tmp/test-scuttlebutt-remote'
t.plan(2)
- rimraf(path, mac(function () {
- var db = levelup(path, {createIfMissing: true})
+ rimraf(path, mac(function (err) {
+ var db = SubLevel(
+ levelup(path, {createIfMissing: true})
+ )
var schema = {test: function () { return new Model} }
+
LevelScuttlebutt(db, 'TEST', schema)
var local = db.scuttlebutt
@@ -58,7 +63,7 @@ tape('parallel open', function (t) {
var path = '/tmp/test-scuttlebutt-remote2'
t.plan(2)
rimraf(path, function () {
- var db = levelup(path, {createIfMissing: true})
+ var db = SubLevel(levelup(path, {createIfMissing: true}))
var schema = {test: Model}
LevelScuttlebutt(db, 'test', schema)
View
4 test/open2.js
@@ -2,6 +2,8 @@
var rimraf = require('rimraf')
var levelup = require('levelup')
+var SubLevel = require('level-sublevel')
+
var Model = require('scuttlebutt/model')
var LevelScuttlebutt
= require('..')
@@ -19,7 +21,7 @@ tape('local open, remote open', function (t) {
var path = '/tmp/test-scuttlebutt-remote'
t.plan(1)
rimraf(path, function () {
- var db = levelup(path, {createIfMissing: true})
+ var db = SubLevel(levelup(path))
var schema = {foo: create(Model), bar: create(Model)}
LevelScuttlebutt(db, 'test', schema)
View
4 test/open3.js
@@ -2,6 +2,8 @@
var rimraf = require('rimraf')
var levelup = require('levelup')
+var SubLevel = require('level-sublevel')
+
var Model = require('scuttlebutt/model')
var LevelScuttlebutt = require('..')
var Client = require('../client')
@@ -14,7 +16,7 @@ tape('remote open, local open', function (t) {
var path = '/tmp/test-scuttlebutt-remote3'
t.plan(2)
rimraf(path, function () {
- var db = levelup(path, {createIfMissing: true})
+ var db = SubLevel(levelup(path))
var schema = {test: Model}
LevelScuttlebutt(db, 'test', schema)
View
3 test/reopen.js
@@ -1,6 +1,7 @@
require('tape')('test', function (t) {
var levelup = require('levelup')
+var SubLevel = require('level-sublevel')
var rimraf = require('rimraf')
var delay = require('delay-stream')
var Model = require('scuttlebutt/model')
@@ -11,7 +12,7 @@ function create(path, cb) {
if(err) return callback(err)
levelup(path, {createIfMissing: true}, function (err, db) {
if(err) throw err
- cb(null, db)
+ cb(null, SubLevel(db))
})
})
}
View
3 test/reopen2.js
@@ -1,6 +1,7 @@
require('tape')('test', function (t) {
var levelup = require('levelup')
+var SubLevel = require('level-sublevel')
var rimraf = require('rimraf')
var delay = require('delay-stream')
var Model = require('scuttlebutt/model')
@@ -13,7 +14,7 @@ function create(path, cb) {
if(err) return callback(err)
levelup(path, {createIfMissing: true}, function (err, db) {
if(err) throw err
- cb(null, db)
+ cb(null, SubLevel(db))
})
})
}

0 comments on commit 226360e

Please sign in to comment.
Something went wrong with that request. Please try again.