@@ -492,20 +492,22 @@ describe('constraints/encoding', () => {
492
492
} ) ;
493
493
} ) ;
494
494
495
- describe ( 'onlyCountWithAutoCountFieldOnSort ' , ( ) => {
495
+ describe ( 'onlyUseCountWithAsteriskSortField ' , ( ) => {
496
496
it ( 'should allow sort with * if and only if count is op' , ( ) => {
497
+ const encQ : EncodingQuery = { channel : Channel . X , field : 'O' , type : Type . ORDINAL } ;
498
+ assert . isTrue ( FIELD_CONSTRAINT_INDEX [ 'onlyUseCountWithAsteriskSortField' ] . satisfy ( encQ , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
497
499
498
- const encQ : EncodingQuery = { channel : Channel . X , field : 'O' , sort : { field : '*' , op : 'count' , order : 'ascending' } , type : Type . ORDINAL } ;
499
- assert . isTrue ( FIELD_CONSTRAINT_INDEX [ 'onlyCountWithAutoCountFieldOnSort ' ] . satisfy ( encQ , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
500
+ const encQ1 : EncodingQuery = { channel : Channel . X , field : 'O' , sort : { field : '*' , op : 'count' , order : 'ascending' } , type : Type . ORDINAL } ;
501
+ assert . isTrue ( FIELD_CONSTRAINT_INDEX [ 'onlyUseCountWithAsteriskSortField ' ] . satisfy ( encQ1 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
500
502
501
503
const encQ2 : EncodingQuery = { channel : Channel . X , field : 'O' , sort : { field : '*' , op : 'mean' , order : 'ascending' } , type : Type . ORDINAL } ;
502
- assert . isFalse ( FIELD_CONSTRAINT_INDEX [ 'onlyCountWithAutoCountFieldOnSort ' ] . satisfy ( encQ2 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
504
+ assert . isFalse ( FIELD_CONSTRAINT_INDEX [ 'onlyUseCountWithAsteriskSortField ' ] . satisfy ( encQ2 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
503
505
504
506
const encQ3 : EncodingQuery = { channel : Channel . X , field : 'O' , sort : { field : 'A' , op : 'count' , order : 'ascending' } , type : Type . ORDINAL } ;
505
- assert . isFalse ( FIELD_CONSTRAINT_INDEX [ 'onlyCountWithAutoCountFieldOnSort ' ] . satisfy ( encQ3 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
507
+ assert . isFalse ( FIELD_CONSTRAINT_INDEX [ 'onlyUseCountWithAsteriskSortField ' ] . satisfy ( encQ3 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
506
508
507
509
const encQ4 : EncodingQuery = { channel : Channel . X , field : 'O' , sort : { field : 'A' , op : 'mean' , order : 'ascending' } , type : Type . ORDINAL } ;
508
- assert . isTrue ( FIELD_CONSTRAINT_INDEX [ 'onlyCountWithAutoCountFieldOnSort ' ] . satisfy ( encQ4 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
510
+ assert . isTrue ( FIELD_CONSTRAINT_INDEX [ 'onlyUseCountWithAsteriskSortField ' ] . satisfy ( encQ4 , schema , new PropIndex < Wildcard < any > > ( ) , defaultOpt ) ) ;
509
511
510
512
511
513
} ) ;
0 commit comments