@@ -523,18 +523,16 @@ describe('quick filter tests', () => {
523523 ( Date . parse ( dateString ) as unknown ) as DateWrapper ;
524524 } ) ;
525525
526- describe ( 'escapeQuickTextFilter ' , ( ) => {
527- // test case, expected result
526+ describe ( 'Escape/UnescapeQuickTextFilter ' , ( ) => {
527+ // unescaped, escaped
528528 test . each ( [
529529 [ '' , '' ] ,
530530 [ ' ' , ' ' ] ,
531- [ null , null ] ,
532531 [ 'test' , 'test' ] ,
533532 [ 'test\\test' , 'test\\test' ] ,
534533 [ 'null\\null' , 'null\\null' ] ,
535534 [ '\\null\\null' , '\\null\\null' ] ,
536535 [ '=test' , '\\=test' ] ,
537- [ '\\=test' , '\\=test' ] ,
538536 [ '\\test' , '\\test' ] ,
539537 [ 'null' , '\\null' ] ,
540538 [ 'NULL' , '\\NULL' ] ,
@@ -546,58 +544,44 @@ describe('quick filter tests', () => {
546544 [ '!null' , '\\!null' ] ,
547545 [ '!=null' , '\\!=null' ] ,
548546 [ '*fish' , '\\*fish' ] ,
549- [ '\\*fish' , '\\*fish' ] ,
550547 [ '=*fish' , '\\=*fish' ] ,
551548 [ 'shooting*' , 'shooting\\*' ] ,
552- [ 'shooting\\*' , 'shooting\\*' ] ,
553549 [ '!=shooting*' , '\\!=shooting*' ] ,
554550 [ '==' , '\\==' ] ,
555551 [ '=' , '\\=' ] ,
556552 [ '!=' , '\\!=' ] ,
557553 [ '!~' , '\\!~' ] ,
558554 [ '~' , '\\~' ] ,
559555 [ '!' , '\\!' ] ,
556+ ] ) (
557+ 'given %p, escape quick filter should return %p and vice versa' ,
558+ ( unescaped , escaped ) => {
559+ expect ( TableUtils . escapeQuickTextFilter ( unescaped ) ) . toBe ( escaped ) ;
560+ expect ( TableUtils . unescapeQuickTextFilter ( escaped ) ) . toBe ( unescaped ) ;
561+ }
562+ ) ;
563+
564+ // escape specific test cases
565+ test . each ( [
566+ [ null , null ] ,
567+ [ '\\=test' , '\\=test' ] ,
568+ [ '\\*fish' , '\\*fish' ] ,
569+ [ 'shooting\\*' , 'shooting\\*' ] ,
560570 ] ) (
561571 'given %p, escape quick filter should return %p' ,
562572 ( testCase , expectedResult ) => {
563573 expect ( TableUtils . escapeQuickTextFilter ( testCase ) ) . toBe ( expectedResult ) ;
564574 }
565575 ) ;
566- } ) ;
567576
568- describe ( 'unescapeQuickTextFilter' , ( ) => {
569- // test case, expected result
577+ // unescape specific test cases
570578 test . each ( [
571- [ '' , '' ] ,
572- [ ' ' , ' ' ] ,
573- [ 'test' , 'test' ] ,
574- [ 'test\\test' , 'test\\test' ] ,
575- [ 'null\\null' , 'null\\null' ] ,
576- [ '\\null\\null' , '\\null\\null' ] ,
577- [ '\\=test' , '=test' ] ,
578579 [ '=test' , '=test' ] ,
579- [ '\\test' , '\\test' ] ,
580580 [ 'null' , 'null' ] ,
581- [ '\\null' , 'null' ] ,
582- [ '\\\\null' , '\\null' ] ,
583- [ '\\NULL' , 'NULL' ] ,
584- [ '\\=null' , '=null' ] ,
585- [ '\\!null' , '!null' ] ,
586- [ '\\!=null' , '!=null' ] ,
587- [ '\\*fish' , '*fish' ] ,
588581 [ '*fish' , '*fish' ] ,
589- [ '\\=*fish' , '=*fish' ] ,
590- [ 'shooting\\*' , 'shooting*' ] ,
591582 [ 'shooting*' , 'shooting*' ] ,
592- [ '\\!=shooting*' , '!=shooting*' ] ,
593583 [ '=' , '=' ] ,
594584 [ '==' , '==' ] ,
595- [ '\\==' , '==' ] ,
596- [ '\\=' , '=' ] ,
597- [ '\\!=' , '!=' ] ,
598- [ '\\!~' , '!~' ] ,
599- [ '\\~' , '~' ] ,
600- [ '\\!' , '!' ] ,
601585 ] ) (
602586 'given %p, unescape quick filter should return %p' ,
603587 ( testCase , expectedResult ) => {
0 commit comments