Commit 1a10bc9d9fd3eba08dd44cd0ee208bdc2651f38f
test errors, offsets, and reverse streams
Dominic Tarr committed on 8/17/2016, 12:13:46 AMParent: 6aedd9c86b41b94a8915e8f5e03c3e2a74c54a74
Files changed
test/simple.js | changed |
test/simple.js | ||
---|---|---|
@@ -20,13 +20,18 @@ | ||
20 | 20 | db.append(new Buffer('hello world'), function (err, offset1) { |
21 | 21 | if(err) throw err |
22 | 22 | db.append(new Buffer('hello offset db'), function (err, offset2) { |
23 | 23 | if(err) throw err |
24 | + t.equal(offset2, 19) | |
24 | 25 | db.get(offset1, function (err, b) { |
26 | + if(err) throw err | |
25 | 27 | t.equal(b.toString(), 'hello world') |
28 | + | |
26 | 29 | db.get(offset2, function (err, b2) { |
30 | + if(err) throw err | |
27 | 31 | t.equal(b2.toString(), 'hello offset db') |
28 | 32 | db.getPrevious(offset2, function (err, b) { |
33 | + if(err) throw err | |
29 | 34 | t.equal(b.toString(), 'hello world') |
30 | 35 | t.end() |
31 | 36 | }) |
32 | 37 | }) |
@@ -58,8 +63,9 @@ | ||
58 | 63 | |
59 | 64 | pull( |
60 | 65 | db.stream({min: 0}), |
61 | 66 | pull.collect(function (err, ary) { |
67 | + console.log("COLLECT", ary) | |
62 | 68 | t.deepEqual(ary.map(String), ['hello world', 'hello offset db']) |
63 | 69 | t.end() |
64 | 70 | }) |
65 | 71 | ) |
@@ -72,14 +78,12 @@ | ||
72 | 78 | }) |
73 | 79 | |
74 | 80 | tape('reverse', function (t) { |
75 | 81 | pull( |
76 | - db.stream({min: 0, reverse: true}), | |
82 | + db.stream({reverse: true}), | |
77 | 83 | pull.collect(function (err, ary) { |
78 | 84 | t.deepEqual(ary.map(String), ['hello offset db', 'hello world']) |
79 | 85 | t.end() |
80 | 86 | }) |
81 | 87 | ) |
82 | - | |
83 | - | |
84 | 88 | }) |
85 | 89 |
Built with git-ssb-web