@@ -19,6 +19,8 @@ import { QueryInfo } from '../../public/QueryInfo';
1919import { ExtendedMap } from '../../public/ExtendedMap' ;
2020import { QueryColumn } from '../../public/QueryColumn' ;
2121
22+ import getDomainDetailsJSON from '../../test/data/dataclass-getDomainDetails.json' ;
23+
2224import {
2325 arrayEquals ,
2426 camelCaseToTitleCase ,
@@ -39,6 +41,7 @@ import {
3941 isNonNegativeFloat ,
4042 isNonNegativeInteger ,
4143 isQuotedWithDelimiters ,
44+ isSetEqual ,
4245 makeCommaSeparatedString ,
4346 parseCsvString ,
4447 parseScientificInt ,
@@ -1490,3 +1493,22 @@ describe('styleStringToObj', () => {
14901493 } ) ;
14911494 } ) ;
14921495} ) ;
1496+
1497+ describe ( 'isSetEqual' , ( ) => {
1498+ test ( 'equivalency' , ( ) => {
1499+ expect ( isSetEqual ( [ ] , new Set ( ) ) ) . toBe ( true ) ;
1500+ expect ( isSetEqual ( [ 1 ] , new Set ( [ 1 , 1 ] ) ) ) . toBe ( true ) ;
1501+ expect ( isSetEqual ( [ 1 ] , [ 1 , 1 ] ) ) . toBe ( true ) ;
1502+ expect ( isSetEqual ( [ 1 , 3 , 2 ] , [ 2 , 1 , 1 , 3 , 2 ] ) ) . toBe ( true ) ;
1503+ expect ( isSetEqual ( [ { x : 'a' , y : 'b' } ] , [ { x : 'a' , y : 'b' } ] ) ) . toBe ( true ) ;
1504+ expect ( isSetEqual ( [ { x : 'a' , y : 'b' } ] , [ { y : 'b' , x : 'a' } ] ) ) . toBe ( true ) ;
1505+ expect ( isSetEqual ( [ undefined , null ] , [ null , undefined ] ) ) . toBe ( true ) ;
1506+
1507+ // Compare more complex objects to check for deep equivalency
1508+ expect ( isSetEqual ( [ { x : 'a' , y : 'b' , z : { a : 'x' , 1 : - 1 } } ] , [ { z : { 1 : - 1 , a : 'x' } , y : 'b' , x : 'a' } ] ) ) . toBe (
1509+ true
1510+ ) ;
1511+ expect ( isSetEqual ( [ getDomainDetailsJSON , 1 ] , [ getDomainDetailsJSON , 1 , 1 ] ) ) . toBe ( true ) ;
1512+ expect ( isSetEqual ( [ getDomainDetailsJSON , 1 ] , [ getDomainDetailsJSON , 1 , 2 ] ) ) . toBe ( false ) ;
1513+ } ) ;
1514+ } ) ;
0 commit comments