@@ -269,60 +269,6 @@ describe("CompareUtils", () => {
269269 } ) ;
270270 } ) ;
271271
272- describe ( "getShallowUnequalKeyValues" , ( ) => {
273- describe ( "with `keys` defined as whitelist" , ( ) => {
274- describe ( "returns empty array if the specified values are shallowly equal" , ( ) => {
275- runTest ( [ ] , { a : 1 , b : [ 1 , 2 , 3 ] , c : "3" } , { b : [ 1 , 2 , 3 ] , a : 1 , c : "3" } , wl ( [ "a" , "c" ] ) ) ;
276- } ) ;
277-
278- describe ( "returns unequal key/values if any specified values are not shallowly equal" , ( ) => {
279- // identical objects, but different instances
280- runTest (
281- [ { key : "a" , valueA : [ 1 , "2" , true ] , valueB : [ 1 , "2" , true ] } ] ,
282- { a : [ 1 , "2" , true ] } ,
283- { a : [ 1 , "2" , true ] } ,
284- wl ( [ "a" ] ) ,
285- ) ;
286- // different primitive-type values
287- runTest ( [ { key : "a" , valueA : 1 , valueB : 2 } ] , { a : 1 } , { a : 2 } , wl ( [ "a" ] ) ) ;
288- } ) ;
289- } ) ;
290-
291- describe ( "with `keys` defined as blacklist" , ( ) => {
292- describe ( "returns empty array if the specified values are shallowly equal" , ( ) => {
293- runTest ( [ ] , { a : 1 , b : [ 1 , 2 , 3 ] , c : "3" } , { b : [ 1 , 2 , 3 ] , a : 1 , c : "3" } , bl ( [ "b" ] ) ) ;
294- } ) ;
295-
296- describe ( "returns unequal keys/values if any specified values are not shallowly equal" , ( ) => {
297- runTest (
298- [ { key : "a" , valueA : [ 1 , "2" , true ] , valueB : [ 1 , "2" , true ] } ] ,
299- { a : [ 1 , "2" , true ] } ,
300- { a : [ 1 , "2" , true ] } ,
301- bl ( [ "b" , "c" ] ) ,
302- ) ;
303- runTest ( [ { key : "a" , valueA : 1 , valueB : 2 } ] , { a : 1 } , { a : 2 } , bl ( [ "b" ] ) ) ;
304- } ) ;
305- } ) ;
306-
307- describe ( "with `keys` not defined" , ( ) => {
308- describe ( "returns empty array if values are shallowly equal" , ( ) => {
309- runTest ( [ ] , { a : 1 , b : "2" , c : true } , { a : 1 , b : "2" , c : true } ) ;
310- runTest ( [ ] , undefined , undefined ) ;
311- runTest ( [ ] , null , undefined ) ;
312- } ) ;
313-
314- describe ( "returns unequal key/values if any specified values are not shallowly equal" , ( ) => {
315- runTest ( [ { key : "a" , valueA : 1 , valueB : 2 } ] , { a : 1 } , { a : 2 } ) ;
316- } ) ;
317- } ) ;
318-
319- function runTest ( expectedResult : any [ ] , a : any , b : any , keys ?: IKeyBlacklist < IKeys > | IKeyWhitelist < IKeys > ) {
320- it ( getCompareTestDescription ( a , b , keys ) , ( ) => {
321- expect ( CompareUtils . getShallowUnequalKeyValues ( a , b , keys ) ) . to . deep . equal ( expectedResult ) ;
322- } ) ;
323- }
324- } ) ;
325-
326272 describe ( "getDeepUnequalKeyValues" , ( ) => {
327273 describe ( "with `keys` defined" , ( ) => {
328274 describe ( "returns empty array if only the specified values are deeply equal" , ( ) => {
0 commit comments