var tape = require('tape')
var memdb = require('memdb')
var merkle = require('./')

tape('add and get', function(t) {
  var graph = merkle(memdb())

  graph.add(null, 'hello', function(err, node1) {
    graph.get([node1.key], function(err, node2) {
      t.same(node1, node2, 'same node')
      t.end()
    })
  })
})

tape('add unknown link', function(t) {
  var graph = merkle(memdb())

  graph.add(['foobar'], 'hello', function(err) {
    t.ok(err, 'add failed')
    t.end()
  })
})
@@ -470,16 +470,316 @@
  t.end()%0A  %7D)%0A%7D)
+%0A%0Atape('get heads', function(t) %7B%0A  var graph = merkle(memdb())%0A%0A  graph.add(null, 'hello', function(err, node) %7B%0A    graph.add(%5Bnode.key%5D, 'world', function(err, head) %7B%0A      graph.heads(function(err, heads) %7B%0A        t.same(heads, %5Bhead.key%5D, 'heads match')%0A        t.end()%0A      %7D)%0A    %7D)%0A  %7D)%0A%7D)

test for heads