git ssb

1+

Dominic / offset-log



Commit 1a10bc9d9fd3eba08dd44cd0ee208bdc2651f38f

test errors, offsets, and reverse streams

Dominic Tarr committed on 8/17/2016, 12:13:46 AM
Parent: 6aedd9c86b41b94a8915e8f5e03c3e2a74c54a74

Files changed

test/simple.jschanged
test/simple.jsView
@@ -20,13 +20,18 @@
2020 db.append(new Buffer('hello world'), function (err, offset1) {
2121 if(err) throw err
2222 db.append(new Buffer('hello offset db'), function (err, offset2) {
2323 if(err) throw err
24+ t.equal(offset2, 19)
2425 db.get(offset1, function (err, b) {
26+ if(err) throw err
2527 t.equal(b.toString(), 'hello world')
28+
2629 db.get(offset2, function (err, b2) {
30+ if(err) throw err
2731 t.equal(b2.toString(), 'hello offset db')
2832 db.getPrevious(offset2, function (err, b) {
33+ if(err) throw err
2934 t.equal(b.toString(), 'hello world')
3035 t.end()
3136 })
3237 })
@@ -58,8 +63,9 @@
5863
5964 pull(
6065 db.stream({min: 0}),
6166 pull.collect(function (err, ary) {
67+ console.log("COLLECT", ary)
6268 t.deepEqual(ary.map(String), ['hello world', 'hello offset db'])
6369 t.end()
6470 })
6571 )
@@ -72,14 +78,12 @@
7278 })
7379
7480 tape('reverse', function (t) {
7581 pull(
76- db.stream({min: 0, reverse: true}),
82+ db.stream({reverse: true}),
7783 pull.collect(function (err, ary) {
7884 t.deepEqual(ary.map(String), ['hello offset db', 'hello world'])
7985 t.end()
8086 })
8187 )
82-
83-
8488 })
8589

Built with git-ssb-web