git ssb

1+

Dominic / offset-log



Commit 0e304652fdabbd84d1a187831abec96dddcf0b42

test using since instead of offset

Dominic Tarr committed on 11/7/2016, 2:31:59 PM
Parent: f86224c1b135034403ce03f634e8f8c00020241a

Files changed

test/simple.jschanged
test/simple.jsView
@@ -15,26 +15,26 @@
1515 })
1616 )
1717
1818 tape('simple', function (t) {
19- t.equal(db.offset.value, undefined)
19 + t.equal(db.since.value, undefined)
2020 var offsets = []
21- var rm = db.offset(function (_v) {
21 + var rm = db.since(function (_v) {
2222 offsets.push(_v)
2323 })
24- db.offset.once(function (_v) {
25- t.equal(_v, 0)
24 + db.since.once(function (_v) {
25 + t.equal(_v, -1)
2626
2727 db.append(new Buffer('hello world'), function (err, offset1) {
2828 if(err) throw err
29- console.log(db.offset.value, offset1)
29 + console.log(db.since.value, offset1)
3030 t.equal(offset1, 0)
3131 //NOTE: 'hello world'.length + 8 (start frame + end frame)
32- t.equal(db.offset.value, 19)
32 + t.equal(db.since.value, 0)
3333 db.append(new Buffer('hello offset db'), function (err, offset2) {
3434 if(err) throw err
3535 t.equal(offset2, 19)
36- t.deepEqual(offsets, [0, 19, 19+15+8], 'appended two records')
36 + t.deepEqual(offsets, [-1, 0, 19], 'appended two records')
3737 db.get(offset1, function (err, b) {
3838 if(err) throw err
3939 t.equal(b.toString(), 'hello world', 'read second value')
4040
@@ -106,9 +106,9 @@
106106 new Buffer('hello world'),
107107 new Buffer('hello offset db'),
108108 ], function (err, offsets) {
109109 if(err) throw err
110- t.deepEqual(offsets, [0, 19])
110 + t.deepEqual(offsets, 19)
111111 t.end()
112112 })
113113
114114 })
@@ -126,10 +126,10 @@
126126 // console.log('OFFSETS', offsets)
127127 // t.end()
128128 // })
129129
130- db.offset.once(function (_offset) {
131- t.equal(_offset, 0, 'offset is zero')
130 + db.since.once(function (_offset) {
131 + t.equal(_offset, -1, 'offset is zero')
132132 })
133133
134134 pull(
135135 db.stream(),
@@ -156,10 +156,10 @@
156156 // console.log('OFFSETS', offsets)
157157 // t.end()
158158 // })
159159
160- db.offset.once(function (_offset) {
161- t.equal(_offset, 0, 'offset is zero')
160 + db.since.once(function (_offset) {
161 + t.equal(_offset, -1, 'offset is zero')
162162 })
163163
164164 db.append(new Buffer('hello world'), function (err, offset) {
165165
@@ -181,4 +181,6 @@
181181
182182
183183
184184
185 +
186 +

Built with git-ssb-web