git ssb

0+

wanderer🌟 / js-dfinity-radix-tree



Commit 17e3279fdc5e46feb844130000299eaf7ca03d0a

added test for deletion after flush

Signed-off-by: wanderer <mjbecze@gmail.com>
wanderer committed on 8/10/2017, 10:28:37 PM
Parent: f7a487bb920714294215da003b16aa40d0a676a2

Files changed

index.jschanged
tests/index.jschanged
index.jsView
@@ -190,8 +190,9 @@
190190 } else {
191191 let branch = getBranch(parent)
192192 branch = branch.map(node => node === root ? null : node)
193193 setBranch(parent, branch)
194 + await this.graph.tree(parent, 2)
194195
195196 joinNodes(parent)
196197 }
197198 }
tests/index.jsView
@@ -133,14 +133,17 @@
133133 const key = crypto.createHash('sha256').update(i.toString()).digest().slice(0, 20)
134134 await tree.set(key, i)
135135 }
136136
137 + await tree.flush()
138 +
137139 for (let i = 0; i < entries; i++) {
138140 const key = crypto.createHash('sha256').update(i.toString()).digest().slice(0, 20)
139141 const value = await tree.get(key)
140142 t.equals(value, i)
141143 }
142144
145 + await tree.flush()
143146 for (let i = 0; i < entries; i++) {
144147 const key = crypto.createHash('sha256').update(i.toString()).digest().slice(0, 20)
145148 await tree.delete(key)
146149 }

Built with git-ssb-web