@@ -441,16 +441,15 @@ describe('SnapshotVersionRequest', function() {
441441 } ) ;
442442 } ) ;
443443
444- describe ( 'invalid json0 path' , function ( ) {
444+ describe ( 'invalid json0v2 path' , function ( ) {
445445 beforeEach ( function ( done ) {
446446 var doc = backend . connect ( ) . get ( 'series' , 'his-dark-materials' ) ;
447- doc . create ( [ { title : 'Golden Compass' } ] , function ( error ) {
448- if ( error ) return done ( error ) ;
449- doc . submitOp ( { p : [ '0' , 'title' ] , od : 'Golden Compass' , oi : 'Northern Lights' } , function ( error ) {
450- if ( error ) return done ( error ) ;
451- doc . submitOp ( { p : [ '1' ] , li : { title : 'Subtle Knife' } } , done ) ;
452- } ) ;
453- } ) ;
447+ async . series ( [
448+ doc . create . bind ( doc , [ { title : 'Golden Compass' } ] ) ,
449+ doc . submitOp . bind ( doc , { p : [ '0' , 'title' ] , od : 'Golden Compass' , oi : 'Northern Lights' } ) ,
450+ doc . submitOp . bind ( doc , { p : [ '1' ] , li : { title : 'Subtle Knife' } } ) ,
451+ doc . submitOp . bind ( doc , { p : [ '1' ] , lm : '0' } )
452+ ] , done ) ;
454453 } ) ;
455454
456455 describe ( 'json0v1' , function ( ) {
@@ -477,13 +476,24 @@ describe('SnapshotVersionRequest', function() {
477476 types . register ( defaultType ) ;
478477 } ) ;
479478
480- it ( 'fetches v2 with json0v2' , function ( done ) {
479+ it ( 'fetches a string-indexed list insertion with json0v2' , function ( done ) {
481480 backend . connect ( ) . fetchSnapshot ( 'series' , 'his-dark-materials' , 2 , function ( error , snapshot ) {
482481 if ( error ) return done ( error ) ;
483482 expect ( snapshot . data ) . to . eql ( [ { title : 'Northern Lights' } ] ) ;
484483 done ( ) ;
485484 } ) ;
486485 } ) ;
486+
487+ it ( 'fetches a list move using a string target' , function ( done ) {
488+ backend . connect ( ) . fetchSnapshot ( 'series' , 'his-dark-materials' , 4 , function ( error , snapshot ) {
489+ if ( error ) return done ( error ) ;
490+ expect ( snapshot . data ) . to . eql ( [
491+ { title : 'Subtle Knife' } ,
492+ { title : 'Northern Lights' }
493+ ] ) ;
494+ done ( ) ;
495+ } ) ;
496+ } ) ;
487497 } ) ;
488498 } ) ;
489499} ) ;
0 commit comments