@@ -8,41 +8,41 @@ import diffToChanges from '../src/difftochanges';
88
99describe ( 'diffToChanges' , ( ) => {
1010 describe ( 'equal patterns' , ( ) => {
11- test ( 0 , '' , '' ) ;
12- test ( 0 , 'abc' , 'abc' ) ;
11+ testDiff ( 0 , '' , '' ) ;
12+ testDiff ( 0 , 'abc' , 'abc' ) ;
1313 } ) ;
1414
1515 describe ( 'insertion' , ( ) => {
16- test ( 1 , '' , 'abc' ) ;
17- test ( 1 , 'abc' , 'abcd' ) ;
18- test ( 1 , 'abc' , 'abcdef' ) ;
19- test ( 2 , 'abc' , 'xxabcyy' ) ;
20- test ( 2 , 'abc' , 'axxbyyc' ) ;
16+ testDiff ( 1 , '' , 'abc' ) ;
17+ testDiff ( 1 , 'abc' , 'abcd' ) ;
18+ testDiff ( 1 , 'abc' , 'abcdef' ) ;
19+ testDiff ( 2 , 'abc' , 'xxabcyy' ) ;
20+ testDiff ( 2 , 'abc' , 'axxbyyc' ) ;
2121 } ) ;
2222
2323 describe ( 'deletion' , ( ) => {
24- test ( 1 , 'abc' , '' ) ;
25- test ( 1 , 'abc' , 'ac' ) ;
26- test ( 1 , 'abc' , 'bc' ) ;
27- test ( 1 , 'abc' , 'ab' ) ;
28- test ( 1 , 'abc' , 'c' ) ;
29- test ( 2 , 'abc' , 'b' ) ;
24+ testDiff ( 1 , 'abc' , '' ) ;
25+ testDiff ( 1 , 'abc' , 'ac' ) ;
26+ testDiff ( 1 , 'abc' , 'bc' ) ;
27+ testDiff ( 1 , 'abc' , 'ab' ) ;
28+ testDiff ( 1 , 'abc' , 'c' ) ;
29+ testDiff ( 2 , 'abc' , 'b' ) ;
3030 } ) ;
3131
3232 describe ( 'replacement' , ( ) => {
33- test ( 2 , 'abc' , 'def' ) ;
34- test ( 2 , 'abc' , 'axc' ) ;
35- test ( 2 , 'abc' , 'axyc' ) ;
36- test ( 2 , 'abc' , 'xybc' ) ;
37- test ( 2 , 'abc' , 'abxy' ) ;
33+ testDiff ( 2 , 'abc' , 'def' ) ;
34+ testDiff ( 2 , 'abc' , 'axc' ) ;
35+ testDiff ( 2 , 'abc' , 'axyc' ) ;
36+ testDiff ( 2 , 'abc' , 'xybc' ) ;
37+ testDiff ( 2 , 'abc' , 'abxy' ) ;
3838 } ) ;
3939
4040 describe ( 'various' , ( ) => {
41- test ( 3 , 'abc' , 'xbccy' ) ;
42- test ( 2 , 'abcdef' , 'defabc' ) ;
43- test ( 4 , 'abcdef' , 'axxdeyyfz' ) ;
44- test ( 4 , 'abcdef' , 'xybzc' ) ;
45- test ( 5 , 'abcdef' , 'bdxfy' ) ;
41+ testDiff ( 3 , 'abc' , 'xbccy' ) ;
42+ testDiff ( 2 , 'abcdef' , 'defabc' ) ;
43+ testDiff ( 4 , 'abcdef' , 'axxdeyyfz' ) ;
44+ testDiff ( 4 , 'abcdef' , 'xybzc' ) ;
45+ testDiff ( 5 , 'abcdef' , 'bdxfy' ) ;
4646 } ) ;
4747
4848 it ( 'works with arrays' , ( ) => {
@@ -62,7 +62,7 @@ describe( 'diffToChanges', () => {
6262 expect ( changes ) . to . have . lengthOf ( 3 ) ;
6363 } ) ;
6464
65- function test ( expectedChangeNumber , oldStr , newStr ) {
65+ function testDiff ( expectedChangeNumber , oldStr , newStr ) {
6666 it ( `${ oldStr } => ${ newStr } ` , ( ) => {
6767 const changes = diffToChanges ( diff ( oldStr , newStr ) , newStr ) ;
6868 const oldStrChars = Array . from ( oldStr ) ;
0 commit comments