@@ -461,6 +461,35 @@ describe(__filename, function () {
461461 . expect ( 'Content-Type' , / j s o n / ) ;
462462 assert . equal ( res . body . code , 0 ) ;
463463 } ) ;
464+
465+ it ( 'does not add an useless revision' , async function ( ) {
466+ let res = await agent . post ( `${ endPoint ( 'setText' ) } &padID=${ testPadId } ` )
467+ . field ( { text : 'identical text\n' } )
468+ . expect ( 200 )
469+ . expect ( 'Content-Type' , / j s o n / ) ;
470+ assert . equal ( res . body . code , 0 ) ;
471+
472+ res = await agent . get ( `${ endPoint ( 'getText' ) } &padID=${ testPadId } ` )
473+ . expect ( 200 )
474+ . expect ( 'Content-Type' , / j s o n / ) ;
475+ assert . equal ( res . body . data . text , 'identical text\n' ) ;
476+
477+ res = await agent . get ( `${ endPoint ( 'getRevisionsCount' ) } &padID=${ testPadId } ` )
478+ . expect ( 200 )
479+ . expect ( 'Content-Type' , / j s o n / ) ;
480+ const revCount = res . body . data . revisions ;
481+
482+ res = await agent . post ( `${ endPoint ( 'setText' ) } &padID=${ testPadId } ` )
483+ . field ( { text : 'identical text\n' } )
484+ . expect ( 200 )
485+ . expect ( 'Content-Type' , / j s o n / ) ;
486+ assert . equal ( res . body . code , 0 ) ;
487+
488+ res = await agent . get ( `${ endPoint ( 'getRevisionsCount' ) } &padID=${ testPadId } ` )
489+ . expect ( 200 )
490+ . expect ( 'Content-Type' , / j s o n / ) ;
491+ assert . equal ( res . body . data . revisions , revCount ) ;
492+ } ) ;
464493 } ) ;
465494
466495 describe ( 'copyPadWithoutHistory' , function ( ) {
0 commit comments