#!/usr/bin/env node

require('proof')(1, function (step, equal, deepEqual) {
    var path = require('path')
    var fs = require('fs')

    var rimraf = require('rimraf')
    var cadence = require('cadence')

    var Locket = require('../..')

    var tmp = path.join(__dirname, '../tmp')

    step(function () {
        var location = path.join(tmp, 'put')
        var locket, iterator, keys = []
        step(function () {
            rimraf(location, step())
        }, function () {
            locket = new Locket(location)
            locket.open({ createIfMissing: true }, step())
        }, function () {
            locket.batch([
              { type: 'put', key: 'a', value: JSON.stringify({ value: 1 }) },
              { type: 'put', key: 'b', value: JSON.stringify({ value: 2 }) },
              { type: 'put', key: 'c', value: JSON.stringify({ value: 3 }) }
            ], step())
        }, function () {
            iterator = locket.iterator()
            // todo: better way to break outer?
            step(function () {
                iterator.next(step())
            }, function (key, value) {
                if (key && value) keys.push(key.toString())
                else step(null)
            })()
        }, function () {
            deepEqual(keys, [ 'a', 'b', 'c' ], 'left most to end')
            iterator.end(step())
        }, function () {
            locket.close(step())
        })
    })
})

@@ -373,29 +373,8 @@
 cket
-, iterator, keys = %5B%5D
 %0A   
@@ -896,32 +896,47 @@
 () %7B%0A           
+ var keys = %5B%5D,
  iterator = lock
@@ -949,16 +949,51 @@
 rator()%0A
+            step(function () %7B%0A    
         
@@ -1036,32 +1036,36 @@
 er?%0A            
+ 
+   
 step(function ()
@@ -1059,32 +1059,36 @@
 p(function () %7B%0A
+    
                 
@@ -1113,32 +1113,36 @@
 ())%0A            
+    
 %7D, function (key
@@ -1168,16 +1168,20 @@
         
+  
+  
 if (key 
@@ -1232,16 +1232,20 @@
         
+    
 else ste
@@ -1264,16 +1264,20 @@
         
+    
 %7D)()%0A   
@@ -1273,32 +1273,36 @@
    %7D)()%0A        
+  
+  
 %7D, function () %7B
@@ -1294,32 +1294,36 @@
 , function () %7B%0A
+    
             deep
@@ -1377,32 +1377,36 @@
 d')%0A            
+    
 iterator.end(ste
@@ -1402,32 +1402,47 @@
 tor.end(step())%0A
+            %7D)%0A
         %7D, funct

Indent iterator bit of iterator test.